Accessing next/prev element while for looping

Joseph Garvin k04jg02 at kzoo.edu
Sun Dec 18 21:26:48 EST 2005


Steven D'Aprano wrote:

>On Sun, 18 Dec 2005 23:36:29 +1100, Steven D'Aprano wrote:
>
>  
>
>>Python lists aren't linked lists? They are arrays.
>>    
>>
>
>[slaps head for the stupid typo]
>That should have been a full stop, not question mark. Python lists are not
>linked lists, period.
>
>
>  
>
All the more inexcusable then, because it's even easier to find the
next/previous element in an array! ;)


Thanks all, Bas/Bangt's solutions are very elegant =)




More information about the Python-list mailing list