You cannot define multiple initializers in Python (as indicated in the comments, is __init__ not a constructor ), but you can define default values, for example
def __init__(self, size=8):
self.buffer = [1] * size
In the above code, a buffer of size 8 is created by default, but if a size parameter is specified, the parameter will be used instead.
, , Example. 8 ( ):
e = Example()
10:
e = Example(10)
:
e = Example(size=10)