[IronPython] Django, __unicode__, and #20366

Vernon Cole vernondcole at gmail.com
Thu Feb 11 16:44:48 CET 2010


Just a little reminder in all this noise...

The correct thing to do with unicode(u'a unicode string') is MAKE NO CHANGE.
The correct thing to do with str('an ASCII string') is MAKE NO CHANGE.

The Zen of Python says:
Explicit is better than implicit.
Special cases aren't special enough to break the rules.
In the face of ambiguity, refuse the temptation to guess.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.

IMHO, if a programmer expects str() or unicode() to make a change in the
encoding of a string-like object, (s)he should be encouraged/forced to use
.encode() or .decode() to get his(er) intended result.
 --
Vernon Cole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100211/022544a3/attachment.html>


More information about the Ironpython-users mailing list