[Python-3000] PEP 3138- String representation in Python 3000 (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Wed May 14 19:43:41 CEST 2008
- Previous message: [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-3000] PEP 3138- String representation in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hardwiring the encoding is not a good idea, esp. since there are lots of alternatives for you to get readable output from PyUnicode object now and without any changes to the interpreter.
E.g. print '%s' % u.encode('utf-8')
We are talking about Python 3 here, so it is fairly important that you consider all syntactic and semantic details of Python 3 - otherwise it is not clear whether or not you are aware of them:
- the print syntax is incorrect
- .encode returns a byte string
- therefore, %s applies str to the byte string, yielding something like b'...', with hex escapes for the non-ASCII bytes
There are many ways to solve your problem.
No. If you strike out those that don't actually work, close to none remain.
Regards, Martin
- Previous message: [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-3000] PEP 3138- String representation in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]