On Aug 30, 8:44 pm, Robert Kern <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > So it's:
> > class MyString(str):
> >    def __init__(self,strInput):
> >       self = strInput
>
> That doesn't quite work. Assigning to "self" only reassigns the name inside 
> the
> function. It does not replace the object.
>
> Instead, call the .__init__() method on str.

That won't do much as strings are immutable objects...
As pointed out by Steve Holden and me, str.__new__ is the way.
--
Arnaud


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

Reply via email to