no side effects

"Martin v. Löwis" martin at v.loewis.de
Wed Jan 8 10:09:27 EST 2003


holger krekel wrote:
> 'i' might not be local but usually it is.  When answering 
> newcomer questions i try to refrain from talking in language
> lawyer details (as much as possible).  I only tried to explain the 
> for-loop from the viewpoint of names bound to objects.  I didn't 
> want to compare iteration protocols between python and C++ just 
> to explain that. 

I'm uncertain though whether an actually incorrect explanation helps the 
newcomer. Namespaces are totally irrelevant for this feature of the for 
loop. The fact that there is a hidden index variable should be easy to 
understand for each newcomer (the fact that the index variable now is an 
iterator might be confusing, though).

Regards,
Martin








More information about the Python-list mailing list