On 11/02/2010 15:44, Vernon Cole wrote:
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.

I assume by ASCII string you actually mean bytestring? (hint: ascii is not the opposite of unicode in this case...)

And how do you propose to tell the difference between a bytestring and a unicode string in IronPython?

Michael



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


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to