Mug a écrit :
hi ,i had a problem on constructor overwrite:
i have something like:
class obj:
def __init__(self, x=100, y=None):
if y is None:
self.x=x
else:
self.y=y
With such an initializer, you'll have instances with an attribute 'y'
and no att
Mug wrote:
> hi ,i had a problem on constructor overwrite:
> i have something like:
>
> class obj:
> def __init__(self, x=100, y=None):
> if y is None:
> self.x=x
> else:
> self.y=y
> so i can call :
> objet = obj() # x=100 y=None
>
Mug writes:
> hi ,i had a problem on constructor overwrite:
> i have something like:
>
> class obj:
> def __init__(self, x=100, y=None):
> if y is None:
> self.x=x
> else:
> self.y=y
> so i can call :
> objet = obj() # x=100 y=None
hi ,i had a problem on constructor overwrite:
i have something like:
class obj:
def __init__(self, x=100, y=None):
if y is None:
self.x=x
else:
self.y=y
so i can call :
objet = obj() # x=100 y=None
or
objet = obj(40) # x= 40 y=None
but if i do :
objet = obj('not