Exec and Scope
manu3d at gmail.com
Fri Oct 31 17:04:14 CET 2008
On Oct 31, 4:38 am, Rafe <rafesa... at gmail.com> wrote:
> If you are just looking to execute an attribute (be it a property,
> module-level function, instance or class method, or anything else
> which is an attribute of an object), just use getattr().
I must check this out. My understanding is that getAttr returns a
function object that happens to be a method of that object. I can then
invoke that function as if I was invoking the method of that object.
What I don't know is: will the function work in a scope where the
object is not defined? And even if it does, what happens to the names
that refer to the containeR or containeD objects?
I've read what I could in the manual about the data model, scope and
namespaces but as you can probably see there still are things I do not
fully comprehend. I feel a bit like seeing the dots but not quite
being able to make the connections between them just yet.
Thanks for your help though! This is providing me with a few ideas for
some more tests to do.
More information about the Python-list