|
|
|
|
|
by duncanfwalker
421 days ago
|
|
For me the point is that __init__ is special - it's the language's the way to construct an object. If we want to side-effecting code we can with a non-special static constructor like class Foo
@classmethod
def connect():
return Foo()._connect() The benefit is that we can choose when we're doing 1) object construction, 2) side-effecting 3) both. The downside is client might try use the __init__() so object creation might need to be documented more than it would otherwise |
|