[issue1308] unicode(None) anomaly

James G. sack (jim) report at bugs.python.org
Mon Oct 22 08:28:39 CEST 2007


James G. sack (jim) added the comment:

Martin v. Löwis wrote:
> Martin v. Löwis added the comment:
> 
> Ok. This is not a bug, but by design. unicode(X)==unicode(str(X)) for
> most things, and str(X)==repr(X) for most things. repr(None)=='None',
> hence the result you see. Closing as invalid.
> 
> P.S. To respond via email, you have to add your email address to Your
> Details (you need to add all email addresses you want to use as From
> addresses).
> 
> ----------
> resolution:  -> invalid
> status: open -> closed
> 
> __________________________________
> Tracker <report at bugs.python.org>
> <http://bugs.python.org/issue1308>
> __________________________________
> 

OK, thanks Martin.

Now that I think about it, I do understand.

My difficulty (and source of my surprise) was in mistakenly thinking of
unicode() as performing a string translation operation (that is, an
operation on strings).

I would now say that it is better thought of as a representation
function quite parallel to the str() function.

With that mindset, there is no surprise.

Thanks again, for your prompt attention and useful replies.

Regards,
..jim

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1308>
__________________________________


More information about the Python-bugs-list mailing list