Accessing next/prev element while for looping

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sun Dec 18 07:58:22 EST 2005


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 :-)


-- 
Steven.




More information about the Python-list mailing list