A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/076095.html below:

[Python-Dev] Backporting PEP 3101 to 2.6

[Python-Dev] Backporting PEP 3101 to 2.6 [Python-Dev] Backporting PEP 3101 to 2.6Nick Coghlan ncoghlan at gmail.com
Fri Jan 11 16:03:53 CET 2008
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, fmt_spec=None):
     if fmt_spec is None: fmt_spec=''
     result = obj.__format__(fmt_spec)
     if isinstance(fmt_spec, unicode):
         if isinstance(result, str):
             result = unicode(result)
     return result

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4