R. David Murray <rdmur...@bitdance.com> added the comment:

If you do a "def foo" in module bar.py, and have a class FooFoo in bar.py, and 
do:

FooFoo.myfoo = foo

and foo refers to an unbound variable, that variable will be looked up in 
bar.py's global name space.

If instead the 'def foo' is in a module parrot.py, and bar.py does:

from parrot import foo
FooFoo.myfoo = foo

and foo contains an unbound variable, that variable will be looked up in 
*parrots* global name space.

So, yes, this is a doc bug of a sort :)  It would be technically correct to 
change it to "The global scope associated with a method is the module 
containing the method's function definition", but that is not suitable for the 
tutorial.  In fact, the discussion of this quirk probably doesn't belong in the 
tutorial; unless, perhaps, in a footnote.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11418>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to