deriving from float or int
Robert Kern
robert.kern at gmail.com
Tue Feb 21 16:01:22 EST 2006
Russ wrote:
> The problem is that when I derive a new class from float, the darn
> thing won't let me create a constructor that accepts more than one
> argument. I need two arguments: one for the numerical value and one for
> the units. But when I try to give the constructor two arguments, I get
> this when I call the constructor:
>
> TypeError: float() takes at most 1 argument (2 given)
>
> In other words, python doesn't seem to want to let me "extend" the
> float type. I don't understand the reason for that, but I assume there
> is a reason.
http://www.python.org/2.2.3/descrintro.html#__new__
--
Robert Kern
robert.kern at gmail.com
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list