[docs] [issue22725] improve documentation for enumerate() (built-in function)

Van Ly report at bugs.python.org
Sat Oct 25 13:20:00 CEST 2014


Van Ly added the comment:

The first mention of iterator should link to 'glossary.html#term-iterator'.

There is a builtin iter() function. This may cause confusion in earlier suggested inline sample code.

-- Use the following inline sample code 
-- in place of 'iter = enumerate(led)'to avoid confusion with iter() builtin:

led = ['red', 'green', 'blue']
iterator = enumerate(led)
try:
    while True:
        print iterator.next()
except StopIteration:
    print 'End of iterator has been reached.'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22725>
_______________________________________


More information about the docs mailing list