Re: [Tutor] Python __del__ method

2017-07-11 Thread Steven D'Aprano
On Tue, Jul 11, 2017 at 07:34:16PM -0500, boB Stepp wrote: > On Tue, Jul 11, 2017 at 7:24 PM, Alan Gauld via Tutor > wrote: > I am assuming that when the OP ran his code from a file, that upon the > script's completion, both object instances were garbage collected. > Surely upon program completi

Re: [Tutor] Python __del__ method

2017-07-11 Thread boB Stepp
On Tue, Jul 11, 2017 at 7:24 PM, Alan Gauld via Tutor wrote: > On 11/07/17 15:47, Jia Yue Kee wrote: >> I am new to Python and I came across the Python __del__ method > > The __del__() method is a bit of an oddity and often not > used in industrial strength Python code. > >> if __name__ == "__main

Re: [Tutor] Python __del__ method

2017-07-11 Thread Alan Gauld via Tutor
On 11/07/17 15:47, Jia Yue Kee wrote: > I am new to Python and I came across the Python __del__ method The __del__() method is a bit of an oddity and often not used in industrial strength Python code. > if __name__ == "__main__": > x = Robot("Tik-Tok") > y = Robot("Jenkins") > z = x

Re: [Tutor] Python __del__ method

2017-07-11 Thread boB Stepp
On Tue, Jul 11, 2017 at 7:13 PM, eryk sun wrote: > On Wed, Jul 12, 2017 at 12:07 AM, eryk sun wrote: >> On Tue, Jul 11, 2017 at 2:47 PM, Jia Yue Kee >> wrote: >>> >>> Case 2: If I were to run the code in "Interactive Mode", the following >>> output will be obtained: >>> >> x = Robot("Tik-T

Re: [Tutor] Python __del__ method

2017-07-11 Thread eryk sun
On Wed, Jul 12, 2017 at 12:07 AM, eryk sun wrote: > On Tue, Jul 11, 2017 at 2:47 PM, Jia Yue Kee > wrote: >> >> Case 2: If I were to run the code in "Interactive Mode", the following >> output will be obtained: >> > x = Robot("Tik-Tok") >> Tik-Tok has been created! > y = Robot("Jenkins"

Re: [Tutor] Python __del__ method

2017-07-11 Thread eryk sun
On Tue, Jul 11, 2017 at 2:47 PM, Jia Yue Kee wrote: > > Case 2: If I were to run the code in "Interactive Mode", the following output > will be obtained: > x = Robot("Tik-Tok") > Tik-Tok has been created! y = Robot("Jenkins") > Jenkins has been created! z = x z > <__main__.Rob

[Tutor] Python __del__ method

2017-07-11 Thread Jia Yue Kee
Hi All, I am new to Python and I came across the Python __del__ method the other day and I have some doubts on the output of the following code. So, the snippet code goes something like this: class Robot(): def __init__(self, name): print(name + " has been created!") def __del