[Python-Dev] str and unicode (original) (raw)

Michael Urman murman at gmail.com
Wed Dec 6 15:15:29 CET 2006


I don't have anything older than 2.4 laying around either, but IIRC in 2.3 unicode() did not call unicode().

It turns out unicode() is called on Python 2.3.5.

% python2.3 Python 2.3.5 (#2, Oct 18 2006, 23:04:45) [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

class Foo(object): ... def unicode(self): ... print "unicode" ... return u"hi" ... def str(self): ... print "str" ... return "hello" ... unicode(Foo()) unicode u'hi'

-- Michael Urman http://www.tortall.net/mu/blog



More information about the Python-Dev mailing list