"spir" <denis.s...@gmail.com> wrote


The issue is the object (self) is then a unicode one instead of my own type.

I think you need to modify self in __new__


class Unicode(unicode):
   Unicode.FORMAT = "utf8"
   def __new__(self, text, format=None):
       # text can be str or unicode
       format = Unicode.FORMAT if format is None else format
       if isinstance(text,str):
           text = text.decode(format)

             self = text.decode(format)

But I've only used __new__ once before so am no expert!

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to