It works on CPython 2.6 at least.  You should only have to override __new__ if 
you wanted to support different arguments than str/unicode.__new__ supports.

> -----Original Message-----
> From: users-boun...@lists.ironpython.com [mailto:users-
> boun...@lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Monday, March 16, 2009 6:02 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] CP Issue #21659: Subclassing unicode
> 
> Jeff Hardy wrote:
> > Hi,
> > Is there any quick workaround for #21569? It's causing about a third
> > of the Genshi errors I'm hitting. Trying to override __init__ in the
> > subclass gives the same error.
> >
> > class Foo(unicode):
> >     def __init__(self, val):
> >         pass
> >
> > f = Foo(1)
> >
> > Traceback (most recent call last):
> >   File "foo.py", line 5, in __main__
> > TypeError: expected str, got int
> >
> 
> Wouldn't that particular example bomb out on CPython as well - you need
> to override __new__ on the immutable builtins surely?
> 
> Michael
> > Thanks,
> > Jeff
> > _______________________________________________
> > Users mailing list
> > Users@lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> 
> 
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
> 
> 
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to