Re: explicit call to __init__(self) in subclass needed?

2009-09-21 Thread Bruno Desthuilliers
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

Re: explicit call to __init__(self) in subclass needed?

2009-09-18 Thread Bruno Desthuilliers
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

Re: explicit call to __init__(self) in subclass needed?

2009-09-18 Thread Bruno Desthuilliers
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

Re: explicit call to __init__(self) in subclass needed?

2009-09-18 Thread Ethan Furman
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

Re: explicit call to __init__(self) in subclass needed?

2009-09-18 Thread Andrew MacKeith
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

explicit call to __init__(self) in subclass needed?

2009-09-17 Thread Andrew MacKeith
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

Re: explicit call to __init__(self) in subclass needed?

2009-09-17 Thread Ethan Furman
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,