Message130628
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. |
|
Date |
User |
Action |
Args |
2011-03-11 22:06:16 | r.david.murray | set | recipients:
+ r.david.murray, eric.araujo, methane, santoso.wijaya, docs@python |
2011-03-11 22:06:16 | r.david.murray | set | messageid: <1299881176.84.0.687230377893.issue11418@psf.upfronthosting.co.za> |
2011-03-11 22:06:16 | r.david.murray | link | issue11418 messages |
2011-03-11 22:06:16 | r.david.murray | create | |
|