[Tutor] Objects, persistence & getting
Max Noel
maxnoel_fr at yahoo.fr
Sun Jan 16 23:42:48 CET 2005
On Jan 16, 2005, at 21:13, Liam Clarke wrote:
> If I understand correctly, once an object is created, as long as
> references to it exist, it isn't garbage collected.
Correct, more or less (in the exception case where a references b, b
references a but nothing else references either, both are GC'd if the
implementation is sound).
> So, if module a.py creates an instance of class foo, can method bar in
> module b.py access foo without foo being passed directly to bar?
Well, if you don't pass at least a reference to what you want the
method/function to act on (assuming bar is not a method of Foo, of
course -- or else, you should know that splitting the implementation of
a class across multiple files, let alone modules, is a Bad Thing(TM)),
how do you expect it to know?
> Does that make sense? So, foo is floating around in the namespace, and
> bar just wants to grab a field of foo. Can it? I had a poke around the
> namespace yesterday, and got lost in hordes of methods that look like
> __this__, which is ugly.
Watch out, you seem to be confusing classes and objects, there.
What are you trying to achieve there, exactly? Could you give us an
example?
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge a
perfect, immortal machine?"
More information about the Tutor
mailing list