Accessing next/prev element while for looping

Steve Holden steve at holdenweb.com
Mon Dec 19 03:00:40 EST 2005


Steven D'Aprano wrote:
> On Sun, 18 Dec 2005 04:50:20 -0800, Max  Erickson wrote:
> 
> 
>>>j is a built-in object used to make complex numbers. Or at least it
>>>was, until you rebound it to the current element from myarray. That's bad
>>>practice, but since using complex numbers is rather unusual, one you will
>>>probably get away with.
>>
>>Is it?
> 
> 
> [snip example]
> 
> Well well, I'll be a monkey's uncle. You learn something new everyday.
> 
> Okay, I was wrong. There is no conflict between using j as a name and the
> built-in j-as-syntax-for-complex-numbers, except for any potential
> conflict in the programmers head.
> 
> That makes me feel a lot less guilty about all the times I wrote for j in
> range loops :-)
> 
> 
Yup, the "j" notation is recognised by the lexer, there's no built-in 
object.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list