Newbie question

Ante abagaric at rest-art.hr
Tue Apr 16 12:33:49 EDT 2002


>
> do some reading about scope... add the following line to dummy.py:
>

Um.. and shouldn't one read the article before replying?

If this is solely a scope problem, then why does it work if you replace
'num += 1' with 'print num'?

Shouldn't it say 'referencing local before assignment yada yada yada'
anyway?

My question was: why does it work if you only use the variable, and doesn't
work if you assign to it? I guess it would actually make sense for plain
assignment, but for += operator, it doesn't seem so.






More information about the Python-list mailing list