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

Nick Coghlan ncoghlan at gmail.com
Fri Jan 17 12:42:59 CET 2014


On 17 Jan 2014 18:03, "Eric Snow" <ericsnowcurrently at gmail.com> wrote:
>
> On Thu, Jan 16, 2014 at 11:30 AM, Eric V. Smith <eric at trueblade.com>
wrote:
> > For the first iteration of bytes.format(), I think we should just
> > support the exact types of int, float, and bytes. It will call the
> > type's__format__ (with the object as "self") and encode the result to
> > ASCII. For the stated use case of 2.x compatibility, I suspect this will
> > cover > 90% of the uses in real code. If we find there are cases where
> > real code needs additional types supported, we can consider adding
> > __format_ascii__ (or whatever name we cook up).
>
> +1

Please don't make me learn the limitations of a new mini language without a
really good reason.

For the sake of argument, assume we have a Python 3.5 with bytes.__mod__
restored roughly as described in PEP 461. *Given* that feature set, what is
the rationale for *adding* bytes.format? What new capabilities will it
provide that aren't already covered by printf-style interpolation directly
to bytes or text formatting followed by encoding the result?

Cheers,
Nick.

>
> -eric
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140117/186705bf/attachment.html>


More information about the Python-Dev mailing list