c[:]()

Terry Reedy tjreedy at udel.edu
Tue Jun 5 18:26:50 EDT 2007


"Warren Stringer" <warren at muse.com> wrote in message 
news:015701c7a7a4$584fac00$240110ac at Muse...
| I am porting code that only uses this form
|    a[:4]b()
|
| Which translates to:
|
| for i in range(4):
|    a[i].b()

Or, more directly and perhaps more efficiently:

for e in a[:4]: e.b()

tjr






More information about the Python-list mailing list