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/2014-January/131557.html below:

[Python-Dev] PEP 461 - Adding % and {} formatting to bytes

[Python-Dev] PEP 461 - Adding % and {} formatting to bytesEthan Furman ethan at stoneleaf.us
Tue Jan 14 22:07:57 CET 2014
On 01/14/2014 12:57 PM, Antoine Pitrou wrote:
> On Tue, 14 Jan 2014 11:56:25 -0800
> Ethan Furman <ethan at stoneleaf.us> wrote:
>>
>> %s, because it is the most general, has the most convoluted resolution:
>>
>>     - input type is bytes?
>>       pass it straight through
>
> It should try to get a Py_buffer instead.

Meaning any bytes or bytes-subtype will support the Py_buffer protocol, and this should be the first thing we try?

Sounds good.

For that matter, should the first test be "does this object support Py_buffer" and not worry about it being 
isinstance(obj, bytes)?


>>     - input type is numeric?
>>       use its __xxx__ [1] [2] method and ascii-encode it (strictly)
>
> What is the definition of "numeric"?

That is a key question.

Obviously we have int, float, and complex.  We also have Decimal.

But what about Fraction?  Or some users numeric class that doesn't inherit from a core numeric type?  Wherever we draw 
the line, we need to make it's well-documented.

--
~Ethan~
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