unicode(obj, errors='foo') raises TypeError - bug?
"Martin v. Löwis"
martin at v.loewis.de
Wed Feb 23 18:54:25 EST 2005
Kent Johnson wrote:
> Could this be handled with a try / except in unicode()? Something like
> this:
Perhaps. However, this would cause a significant performance hit, and
possbibly undesired side effects. So due process would require that the
interface of __unicode__ first, and then change the actual calls to it.
> One thing that hasn't been pointed out in this thread yet is that the OP
> could just define __unicode__() on his class to do what he wants...
Actually, Steven Bethard wrote "You should either define __unicode__ or
call str() manually on the object."
Regards,
Martin
More information about the Python-list
mailing list