Polymorphism using constructors

K Viltersten tmp1 at viltersten.com
Mon Mar 3 15:21:17 EST 2008


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__ (0, 1)

but for some reason (not known to me at
this point) i get errors. My suspicion 
is that it's a syntax issue.

Suggestions?

--
Regards
Konrad Viltersten
--------------------------------
sleep    - a substitute for coffee for the poor
ambition - lack of sense to be lazy




More information about the Python-list mailing list