questions about scope/threading

Aahz aahz at pythoncraft.com
Fri Nov 29 08:02:10 EST 2002


In article <ar3t8n$q9$2 at wheel2.two14.net>,  <maney at pobox.com> wrote:
>Aahz <aahz at pythoncraft.com> wrote:
>>
>> One way or another, every object in Python is reachable using Python
>> code.
>
>Well, sure.  At least if you subscribe to the peculiar theory that
>thinks that gc has to collect every unreachable object before the
>program exits.
>
>I would complain that you willfully misconstrued my meaning - I was, of
>course, thinking about bound objects - but I certainly ought to know
>better than to accidentally leave you a semantic ambiguity to play
>with! :-)

gc was just an example.  Try playing with sys._getframe() for another
example.  The point is that *ALL* Python objects are by definition bound;
if they're not bound, the refcount is zero and the object is deleted.
There really is no such thing as an unreachable Python object (unless you
deliberately create one in a C library and never pass it back to Python).

This isn't semantic games, it goes right to the core of Python's power
and capabilities.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra



More information about the Python-list mailing list