Re: Polymorphism using constructors

2008-03-04 Thread castironpi
On Mar 4, 7:06 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > On Mar 4, 2008, at 4:53 PM, Jeff Schwab wrote: > > > What does "SV" in the subject mean? > > SV = "Svar" is the Norwegian word for Reply. > > Cheers >    Tommy It is also the name of my lockermate in grade school. "So, Svar, how 'bout the

Re: Polymorphism using constructors

2008-03-03 Thread castironpi
On Mar 3, 4:03 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 3, 4:17 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > Since Python doesn't support having two methods with the same name, > > the usual solution is to provide alternative constructors using > > classmethod(): > > >   @classm

Re: Polymorphism using constructors

2008-03-03 Thread Carl Banks
On Mar 3, 4:17 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Since Python doesn't support having two methods with the same name, > the usual solution is to provide alternative constructors using > classmethod(): > > @classmethod > def from_decimal(cls, d) > sign, digits, exp = d.as

Re: Polymorphism using constructors

2008-03-03 Thread Raymond Hettinger
On Mar 3, 12:21 pm, "K Viltersten" <[EMAIL PROTECTED]> wrote: > I'm writing a class for rational numbers > and besides the most obvious constructor > > def __init__ (self, nomin, denom): > > i also wish to have two supporting ones > > def __init__ (self, integ): > self.__init__ (integ, 1) >

Re: Polymorphism using constructors

2008-03-03 Thread Diez B. Roggisch
K Viltersten schrieb: > I'm writing a class for rational numbers > and besides the most obvious constructor > > def __init__ (self, nomin, denom): > > i also wish to have two supporting ones > > def __init__ (self, integ): >self.__init__ (integ, 1) > def __init__ (self): >self.__init_