On Sun, Sep 20, 2015 at 5:36 AM, Eric V. Smith <e...@trueblade.com> wrote:
> As the PEP says, the expression with '+' is illustrative, not how it's
> actually implemented. The implementation currently uses ''.join,
> although I reserve the right to change it.
>
>> or even to
>>
>>     'abc{:spec1}{!r:spec2}def{!s}ghi'.format(expr1, expr2, expr3)
>
> That's surprisingly difficult to get right. I've implemented the code at
> least 3 different ways, and the current implementation seems the most
> straightforward. I might add a special opcode to use a _PyUncode_Writer,
> though.

Since this is entirely under the control of the parser, there's no
particular reason to promise anything about the implementation or its
performance metrics. The semantics won't change if CPython 3.7.4
decides to change to using ''.join() instead of concatenation.

Let's not bikeshed the implementation details. I'm sure Eric knows
what he's doing.

ChrisA
_______________________________________________
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/archive%40mail-archive.com

Reply via email to