"Carlos" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> Do you know a better way to do this?
>
>            if i < A_Len-1:
>                a = A_List[i-1]
>                b = A_List[i]
>                c = A_List[i+1]
>            else:
>                a = A_List[i-1]
>                b = A_List[i]
>                c = A_List[0]

You would think so, just by looking at it, but I must confess
I can't offhand think of anytthing significantly better. The only
way to make it more consistent would be to
1) implement a real circular list (there probably is one out there 
somewhere....)
2) always duplicate the first entry at the end of the list, then stop 
an len-2.

HTH,

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to