Python3 - How do I import a class from another file

Rhodri James rhodri at kynesim.co.uk
Wed Dec 11 09:42:14 EST 2019


On 11/12/2019 14:17, Musbur wrote:
> Am 10.12.2019 22:33 schrieb Paul Moore:
> 
>> You do understand that the reference counting garbage collector is an
>> implementation detail of the CPython implementation *only*, don't you?
> 
> I don't think that's true. Here's a sentonce from near the top of the 
> "gc" module documentation of Python 3:
> https://docs.python.org/3/library/gc.html#module-gc
> 
> "Since the collector supplements the reference counting already used in 
> Python, you can disable the collector if you are sure your program does 
> not create reference cycles."
> 
> The way I read this is that Python automatically and immediately deletes 
> objects once their refcount goes to zero, and the garbage collector only 
> kicks in case of circular references or other obscure circumstances. The 
> documentation makes no reference to the specific Python implementation, 
> so I believe this is true for CPython as well as others.

That's a bug in the documentation, and needs fixing; thanks for pointing 
it out!  It is certainly true that some other Python implementations 
(Jython for example) do not use reference counting, and disabling the 
collector may have further-reaching implications for those 
implementations.  I can't speak to the details; the only other 
implementation I use is Micropython, and I don't use that often enough 
to have cared about the details of garbage collection beyond noting that 
it's different to CPython.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-list mailing list