Andrew MacKeith a écrit :
Bruno Desthuilliers wrote:
Andrew MacKeith a écrit :
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed
to
Ethan Furman a écrit :
Andrew MacKeith wrote:
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed to
Y.__init__() ?
Is this behavior
Andrew MacKeith a écrit :
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed to
Y.__init__() ?
It happens in the __new__ method (which
Bruno Desthuilliers wrote:
Ethan Furman a écrit :
Andrew MacKeith wrote:
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed
to
Bruno Desthuilliers wrote:
Andrew MacKeith a écrit :
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed to
Y.__init__() ?
It happens
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed to
Y.__init__() ?
Is this behavior specific to the str type, or do base classes not need
Andrew MacKeith wrote:
I create a class like this in Python-2.6
class Y(str):
... def __init__(self, s):
... pass
...
y = Y('giraffe')
y
'giraffe'
How does the base class (str) get initialized with the value passed to
Y.__init__() ?
Is this behavior specific to the str type,