Skip to main content
Dressed the naked links.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 109
  • 132

According to this discussion: http://bytes.com/topic/python/answers/464012-objects-list-indexobject's list index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in range function:

for i in range(len(sequence)):
    # workWork with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new zip built-in function:

for i in range(len(sequence)):
    e = sequence[i]
    # workWork with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # workWork with index i and element e

via http://www.python.org/dev/peps/pep-0212/PEP 212 – Loop Counter Iteration.

According to this discussion: http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in range function:

for i in range(len(sequence)):
    # work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new zip built-in function:

for i in range(len(sequence)):
    e = sequence[i]
    # work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

According to this discussion: object's list index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in range function:

for i in range(len(sequence)):
    # Work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new zip built-in function:

for i in range(len(sequence)):
    e = sequence[i]
    # Work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # Work with index i and element e

via PEP 212 – Loop Counter Iteration.

deleted 3 characters in body
Source Link
Georgy
  • 13.4k
  • 7
  • 66
  • 75

According to this discussion: http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in 'range'range function:

for i in range(len(sequence)):
    # work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new 'zip'zip built-in function[2]function:

for i in range(len(sequence)):
    e = sequence[i]
    # work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

According to this discussion: http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in 'range' function:

for i in range(len(sequence)):
    # work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new 'zip' built-in function[2]:

for i in range(len(sequence)):
    e = sequence[i]
    # work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

According to this discussion: http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in range function:

for i in range(len(sequence)):
    # work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new zip built-in function:

for i in range(len(sequence)):
    e = sequence[i]
    # work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

Post Undeleted by Jean-François Fabre
Post Deleted by Jean-François Fabre
deleted 47 characters in body
Source Link
Martijn Pieters
  • 1.1m
  • 313
  • 4.2k
  • 3.4k

According to this discussion:  http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration The

The current idiom for looping over the indices makes use of the built built-in 'range' function:

    for i in range(len(sequence)):
        # work with index i

Looping over both elements and indices can be achieved either by the
old idiom or by using the new 'zip' built-in function[2]:

    

Looping over both elements and indices can be achieved either by the old idiom or by using the new 'zip' built-in function[2]:

for i in range(len(sequence)):
        e = sequence[i]
        # work with index i and element e
 
or

    

or

for i, e in zip(range(len(sequence)), sequence):
        # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

According to this discussion:http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration The current idiom for looping over the indices makes use of the built-in 'range' function:

    for i in range(len(sequence)):
        # work with index i

Looping over both elements and indices can be achieved either by the
old idiom or by using the new 'zip' built-in function[2]:

    for i in range(len(sequence)):
        e = sequence[i]
        # work with index i and element e
 
or

    for i, e in zip(range(len(sequence)), sequence):
        # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

According to this discussion:  http://bytes.com/topic/python/answers/464012-objects-list-index

Loop counter iteration

The current idiom for looping over the indices makes use of the built-in 'range' function:

for i in range(len(sequence)):
    # work with index i

Looping over both elements and indices can be achieved either by the old idiom or by using the new 'zip' built-in function[2]:

for i in range(len(sequence)):
    e = sequence[i]
    # work with index i and element e

or

for i, e in zip(range(len(sequence)), sequence):
    # work with index i and element e

via http://www.python.org/dev/peps/pep-0212/

Source Link
thinker007
  • 535
  • 4
  • 6
Loading