[Python-Dev] Backporting PEP 3101 to 2.6 (original) (raw)
Steve Holden steve at holdenweb.com
Fri Jan 11 17:19:02 CET 2008
- Previous message: [Python-Dev] Backporting PEP 3101 to 2.6
- Next message: [Python-Dev] Backporting PEP 3101 to 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan wrote:
Guido van Rossum wrote:
For data types whose output uses only ASCII, would it be acceptable if they always returned an 8-bit string and left it up to the caller to convert it to Unicode? This would apply to all numeric types. (The date/time types have a strftime() style API which means the user must be able to specifiy Unicode.) To elaborate on this a bit (and handwaving a lot of important details out of the way) do you mean something like the following for the builtin format?: def format(obj, fmtspec=None): if fmtspec is None: fmtspec='' result = obj.format(fmtspec) if isinstance(fmtspec, unicode): if isinstance(result, str): result = unicode(result) return result Isn't unicode idempotent? Couldn't
if isinstance(result, str):
result = unicode(result)
avoid repeating in Python a test already made in C by re-spelling it as
result = unicode(result)
or have you hand-waved away important details that mean the test really is required?
regards Steve
Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/
- Previous message: [Python-Dev] Backporting PEP 3101 to 2.6
- Next message: [Python-Dev] Backporting PEP 3101 to 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]