[Tutor] Speed of accessing list components

Bob Gailer bgailer at alum.rpi.edu
Sat Jun 26 11:18:22 EDT 2004


At 08:08 AM 6/26/2004, Dragonfirebane at aol.com wrote:
>[snip]
>It seems to me that one easy(er) way of doing this would be:
>
>for i in l:
>     print l[-i]
>
>which would achieve the same effect with no discernable slowdown and a 
>less awkward range.

Only for the special case where the list consists of consecutive integers 
starting with 1.

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 




More information about the Tutor mailing list