Sub-classing unicode: getting the unicode value
Torsten Bronger
bronger at physik.rwth-aachen.de
Sun Dec 30 17:38:17 EST 2007
Hallöchen!
Martin v. Löwis writes:
>> How does my object get its own value?
>
> def __unicode__(self):
> return unicode(self)
I get an endless recursion with this.
I must admit, though, that I probably overestimate the costs
connected with unicode(my_excerpt) because Gabriel is probably right
that no real conversion takes place. A mere attribute lookup may
still be cheaper, but only very slightly.
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger at jabber.org
(See http://ime.webhop.org for further contact info.)
More information about the Python-list
mailing list