None assigment

Aahz Maruch aahz at
Thu Feb 8 23:49:44 EST 2001

In article <_BHg6.195181$ge4.67634054 at>,
Rainer Deyke <root at> wrote:
>"Aahz Maruch" <aahz at> wrote in message
>news:95umoi$is5$1 at
>> What you're missing is the issue of Python scopes.  Try this:
>> b=2
>> def foo():
>>     b=4
>>     print b
>>     del b
>>     global b
>>     print b
>> foo()
>And what *you*'re missing is that whether a variable is local or global is
>determined at compile time (in the absensce of 'exec' or 'from ... import
>*').  The above does not work.  

It doesn't, eh?  Did you try running it?  (After a few blunders of my
own, I rarely post code to without testing it -- just to make
sure.)  Note that this is not the same as the issue with None, but it's
still a scoping issue.
                      --- Aahz (Copyright 2001 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

"Actually, I've found that Usenet has helped a lot with my terror of
social stupidity.  Seeing people I really like and respect behave like
idiots in public has been very beneficial."  --Rachael Lininger

More information about the Python-list mailing list