En Wed, 13 Jun 2007 03:01:16 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]>  
escribió:

> I'm writing a program and want to create a class that is derived from
> the "str" base type.  When I do so, however, I have problems with the
> __init__ method.  When I run the code below, it will call my new
> __init__ method when there is zero or one (value) parameter.  However,
> if I try to pass two parameters or a named parameter, then it dies
> with an error indicating that it's actually trying to call the
> "str:__init__" method instead.

__init__ is rather useless for immutable types. You have to override  
__new__ instead.
See <http://docs.python.org/ref/customization.html>

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to