osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python3 - How do I import a class from another file


Paul,

> You do understand that the reference counting garbage collector is an
> implementation detail of the CPython implementation *only*, don't you?

No, I don't.   But do tell how that matters to me.

> there can be an indefinite delay between the last reference to
> a value being lost and the object being collected (which is
> when __del__ gets called).

Nope.

As I've posted a number of messages back, I've created a test program which 
disables that periodically-called garbage collector and than created and 
destroyed a class instance.  The print command I had put into its __del__ 
method was called regardless.    Which, according to your above claim, 
should not have happened.

I (currently) do not care much for how other implementations do it, but feel 
free to find one which actually does it the way you claim it happens.   But 
if-and-when you find one be sure to also post how they deal with the, also 
mentioned before, inherent race conditions. :-)

> If all you are interested is the semantics of the current CPython
> release, then your statements are true.

Thank you !

Thats, for the moment, /all/ I needed to know.  (no Dennis, I have not 
forgotten you said the same :-) ).

I hope you do realize you are now contradicting Greg, who started all of 
this by his blunt claim that "it was only working by accident" as well as 
Chris who agreed with him ?

>But why would anyone here know that you were looking at the
>situation from such a limited perspective?

Look at the subject line and my initial question.  It pretty-much /screams/ 
that I'm a new to the language (and specifies which version).  Do you think 
that I care much, if anything, about how /other/ implementations work before 
I have got a handle on this one ?

But do tell: How many Python 3 (CPython?  is that the same?) implementations 
are there, and how many do actually lazily call the __del__ method (when its 
trying to free up some memory) ?

> And your attitude seems to be confrontational and aggressive.

I take it you mean "has become".  Yep, that happens when I ask a simple 
question and everyone just keeps posting "your have to take our word for 
it!" posts, while refusing to even address my "but this is what happens!" 
examples.

Besides, I'm Dutch, I'm supposed to be rude. :-)

Regards,
Rudy Wieser