[Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

Nick Coghlan ncoghlan at gmail.com
Thu Jan 9 20:26:04 CET 2014


On 9 Jan 2014 06:43, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
>
> Hi,
>
> With Victor's consent, I overhauled PEP 460 and made the feature set
> more restricted and consistent with the bytes/str separation.

+1

I was initially dubious about the idea, but the proposed semantics look
good to me.

We should probably include format_map for consistency with the str API.

>However, I
> also added bytearray into the mix, as bytearray objects should
> generally support the same operations as bytes (and they can be useful
> *especially* for network programming).

So we'd define the *format* string as mutable to get a mutable result out
of the formatting operations? This seems a little weird to me.

It also seems weird for a format method on a mutable type to *not* perform
in-place mutation.

On the other hand, I don't see another obvious way to control the output
type.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
>
> On Mon, 6 Jan 2014 14:24:50 +0100
> Victor Stinner <victor.stinner at gmail.com> wrote:
> > Hi,
> >
> > bytes % args and bytes.format(args) are requested by Mercurial and
> > Twisted projects. The issue #3982 was stuck because nobody proposed a
> > complete definition of the "new" features. Here is a try as a PEP.
> >
> > The PEP is a draft with open questions. First, I'm not sure that both
> > bytes%args and bytes.format(args) are needed. The implementation of
> > .format() is more complex, so why not only adding bytes%args? Then,
> > the following points must be decided to define the complete list of
> > supported features (formatters):
>
>
> _______________________________________________
> 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/20140110/c72fb9e4/attachment.html>


More information about the Python-Dev mailing list