Today, it was found entering code custom __del__ destructor method as used in the IDLE code, and run results of different pycharm
class Person:
def __del__(self):
print("销毁对象:{0}".format(self))
p1 = Person()
p2 = Person()
del p1
print("程序结束")
IDLE The results are as follows:
销毁对象:<__main__.Person object at 0x0000000002E2AC88>
程序结束
Pycharm operating results are as follows:
销毁对象:<__main__.Person object at 0x0000000001DD8B00>
程序结束
销毁对象:<__main__.Person object at 0x00000000021B2B00>
By looking for relevant information found:
IDLE : is an interactive mode of the compiler, there is no garbage collection
PyCharm : an optimizing compiler, garbage collection will automatically run, it will automatically trigger the recovery of all creation __del__ examples. Meanwhile pycharm the debug mode will not automatically trigger recovery mechanisms, consistent operating results of its operating results and IDLE.