deriving from float or int

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Tue Feb 21 17:43:25 EST 2006


Russ enlightened us with:
> 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.

Use __new__, not __init__. It's the function that's called when a new
immutable object is created.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list