osdir.com


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

Python3 - How do I import a class from another file


Chris,

> Okay. What should happen when you do this?
>
> x = 5
> del x
>
> Should the integer 5 be deleted?

Yep.

What do you think happens instead ?   I've not seen you explain or support 
anything in that regard, not even now.

There is a bit of a problem with the above though: It has got zero to do 
with the __del__ I was talking about.  I've not seen you point out any 
mistake with my example (pointing out race contition problems) either.

Not a smooth move bro.  Not a smooth move /at all/ :-(

> So the language designers couldn't possibly have been so stupid
> as to do things this way, but you're going to ignore what they did?

Actually, they didn't.

Did you know you can disable the garbage collector ?  Well, you can.   Guess 
what I saw when I disabled it, created a class instance and than deleted it 
again.  Yup, the "print" command I placed in the "__del__" method did 
actually show output - something that, according to you, could/should never 
happen ...

Than again, I've used Python 3 for the test.  Maybe you're remembering 
something from an older version ?

Regards,
Rudy Wieser