Python3 - How do I import a class from another file

R.Wieser address at not.available
Wed Dec 11 07:34:00 EST 2019


MRAB,

> You don't "del" an instance, you "del" a reference, which might be in the 
> form of a name in a namespace.

Remember me, the newbie to the language ?

Did you understand what I tried to to say ?   Good.  Thats al that matters.

> When the instance is collected, whenever that happens to be, its "__del__" 
> method is called.

You're introducing the word "collected", while not giving /any/ explanation 
what it means to you(!) or which of the two(or more ?) garbage collectors 
does that "collecting".   And I'm supposed to figure out what happens 
regardless ?    Really ?

Also, I have explained how that lazily calling of the __del__ method could 
easily create race condition problems.  Care to comment ?

> The language definition doesn't specify that reference counting must be 
> used; that's just what CPython happens to use, and it's nice in that 
> collection tends to happen sooner.

Why is it that you guys keep equating "collection" to "call the __del__ 
method" ?   Explain that to me that please.

I myself can easily imagine that the __del__ method is called as a result of 
the reference count going Zero, and the actual "collection" (freeing up the 
local variables and releasing the occupied memory) takes place only when the 
implemented (single?) garbage collector feels like it (though I could also 
imagine that the releasing (not collecting!) of local variables could also 
be done directly after the above __del__ method has been called).

Regards,
Rudy Wieser




More information about the Python-list mailing list