Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107985
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Code Opinion - Enumerate |
| Date | 2016-05-01 22:24 -0700 |
| Message-ID | <mailman.306.1462166700.32212.python-list@python.org> (permalink) |
| References | <0a2a0652-85c2-4283-a3c4-3ca8bc4e5481@googlegroups.com> <1462166698.1168771.595278561.2A184D4B@webmail.messagingengine.com> |
On Sun, May 1, 2016, at 08:17 PM, Sayth Renshaw wrote:
> Just looking for your opinion on style would you write it like this
> continually calling range or would you use enumerate instead, or neither
> (something far better) ?
I can't comment on your specific code because there's too much noise to
it, but in general:
Using enumerate increases readability, and I use it whenever the idiom:
for index, item in enumerate(thing):
...
is used.
Enumerate is your friend. Hug it.
--
Stephen Hansen
m e @ i x o k a i . i o
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Code Opinion - Enumerate Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-01 20:17 -0700
Re: Code Opinion - Enumerate Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-01 20:37 -0700
Re: Code Opinion - Enumerate Stephen Hansen <me+python@ixokai.io> - 2016-05-01 22:24 -0700
Re: Code Opinion - Enumerate Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-01 23:28 -0700
Re: Code Opinion - Enumerate Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-02 00:52 -0700
csiph-web