|
|
Subscribe / Log in / New account

Re: RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

From:  Nick Coghlan <ncoghlan-AT-gmail.com>
To:  Antoine Pitrou <solipsis-AT-pitrou.net>
Subject:  Re: RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
Date:  Fri, 10 Jan 2014 05:26:04 +1000
Message-ID:  <CADiSq7frHxwbCZz3C=U-kOkNqRw0vhRdMbumREp4FtcYzyVrpw@mail.gmail.com>
Cc:  python-dev-AT-python.org

On 9 Jan 2014 06:43, "Antoine Pitrou" <solipsis@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@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@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghl...



to post comments


Copyright © 2014, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds