[python-advocacy] How programming language webpages should be designed
Tarek Ziadé
ziade.tarek at gmail.com
Thu Nov 12 16:19:03 CET 2009
On Thu, Nov 12, 2009 at 3:39 PM, Ray Allen <rayallen153 at googlemail.com> wrote:
[..]
>
> # Loop through list
> count = 1
> print "Python is ... "
> for each in python:
> print count,each
> count += 1
I'd replace this bloc by:
# Loop through list
print "Python is ... "
for index, each in enumerate(python):
print index + 1, each
(using enumerate is much more pythonic than using a count variable)
Regards
Tarek
More information about the Advocacy
mailing list