+ 1
Is it must to create a __init__ method in a class?
Assigning property by __init__ is quite convinient, but just to check the compulsion of having a __init__ method, i tried this one: http://www.sololearn.com/app/JUMP_LINK__&&__python__&&__JUMP_LINK/playground/chC0rWvmtmgS/
2 Antworten
+ 1
no it's not necessary
class A(object):
def f():
print 'foo'
a =A()
a.f()
0
its not a must