+ 2
how to create a destructor of a class?
4 Answers
+ 5
class FooType(object):
def __init__(self, id):
self.id = id
print self.id, 'born'
def __del__(self):
print self.id, 'died'
f= FooType(2)
2, born
2, died
0
Why does 'born' here not need parentheses?
0
Yves: you indeed need parentheses after print at least on QPython 3 for Android... and I guess in Python 3.x in general.
0
Yeah QPython is based on Python 3.3 as far as I know.