Python3 - How do I import a class from another file

musbur at posteo.org musbur at posteo.org
Wed Dec 11 16:32:46 EST 2019


On Tue, 10 Dec 2019 14:56:10 -0500
Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:

> 
> 	It is called when the language IMPLEMENTATION decides to call
> it. That time is not specified in the language description/reference
> manual.

Yes it is:

"Note: del x doesn’t directly call x.__del__() — the former decrements 
the reference count for x by one, and the latter is only called when
x’s reference count reaches zero."

Plain and simple: When the refcount reaches zero. A few lines down,
however, it says:

> 	Any code that is based upon assuming memory reclamation takes
> place at any specific time (other than program exit) is erroneous. 

That is correct, but the decision when to reclaim memory is not made by
__del__ but by the memory management subsystem after (for instance, in
CPython) calls to PyMem_Free()

> 	Some implementations do not use a reference counter -- they
> rely solely upon a periodic mark&sweep garbage collector. cf:

Correct again, but the fray in this thread is about when __del__ is
called, not when memory reclaim takes place. Two different things.


More information about the Python-list mailing list