While finishing up the implementation of PEP 498, I realized that the
PEP has an error. It says that this code:
f'abc{expr1:spec1}{expr2!r:spec2}def{expr3:!s}ghi'
Is equivalent to:
'abc' + expr1.__format__(spec1) + repr(expr2).__format__(spec2) + 'def'
+ str(expr3).__format__('') + 'ghi'
But th
Good catch, Eric.
For those who wonder what the difference is or why it matters, it's what we
do for all dunder operators: the magic method is looked up on the class,
not on the instance. This means you can't e.g. override + on a per-instance
basis by having an instance variable named '__add__' po
On 19.09.15 14:03, Eric V. Smith wrote:
While finishing up the implementation of PEP 498, I realized that the
PEP has an error. It says that this code:
f'abc{expr1:spec1}{expr2!r:spec2}def{expr3:!s}ghi'
Is equivalent to:
'abc' + expr1.__format__(spec1) + repr(expr2).__format__(spec2) + 'def'
+
On 9/19/2015 3:22 PM, Serhiy Storchaka wrote:
> On 19.09.15 14:03, Eric V. Smith wrote:
>> While finishing up the implementation of PEP 498, I realized that the
>> PEP has an error. It says that this code:
>>
>> f'abc{expr1:spec1}{expr2!r:spec2}def{expr3:!s}ghi'
>>
>> Is equivalent to:
>>
>> 'abc'
On 9/19/2015 3:36 PM, Eric V. Smith wrote:
> On 9/19/2015 3:22 PM, Serhiy Storchaka wrote:
>> On 19.09.15 14:03, Eric V. Smith wrote:
>>> Instead of calling __format__, I've changed the code generator to call
>>> format(expr1, spec1). As an optimization, I might add special opcodes to
>>> deal with
On Sun, Sep 20, 2015 at 5:36 AM, Eric V. Smith 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'
On 19 September 2015 at 21:03, Eric V. Smith wrote:
> While finishing up the implementation of PEP 498, I realized that the
> PEP has an error. It says that this code:
>
> f'abc{expr1:spec1}{expr2!r:spec2}def{expr3:!s}ghi'
>
> Is equivalent to:
>
> 'abc' + expr1.__format__(spec1) + repr(expr2).__f
On 9/20/2015 8:37 AM, Nick Coghlan wrote:
> On 19 September 2015 at 21:03, Eric V. Smith wrote:
>> Instead of calling __format__, I've changed the code generator to call
>> format(expr1, spec1). As an optimization, I might add special opcodes to
>> deal with this and string concatenation, but that
On 20.09.15 16:51, Eric V. Smith wrote:
On 9/20/2015 8:37 AM, Nick Coghlan wrote:
On 19 September 2015 at 21:03, Eric V. Smith wrote:
Instead of calling __format__, I've changed the code generator to call
format(expr1, spec1). As an optimization, I might add special opcodes to
deal with this a
> On Sep 20, 2015, at 11:15 AM, Serhiy Storchaka wrote:
>
>> On 20.09.15 16:51, Eric V. Smith wrote:
>>> On 9/20/2015 8:37 AM, Nick Coghlan wrote:
On 19 September 2015 at 21:03, Eric V. Smith wrote:
Instead of calling __format__, I've changed the code generator to call
format(exp
On 21 September 2015 at 05:22, Eric V. Smith wrote:
>
>> On Sep 20, 2015, at 11:15 AM, Serhiy Storchaka wrote:
>>
>>> On 20.09.15 16:51, Eric V. Smith wrote:
On 9/20/2015 8:37 AM, Nick Coghlan wrote:
> On 19 September 2015 at 21:03, Eric V. Smith wrote:
> Instead of calling __format
11 matches
Mail list logo