[Python-ideas] Alternative spelling for list.append()

Alexandre Brault abrault at mapgears.com
Sun Jun 17 19:53:38 EDT 2018



On 2018-06-17 7:36 PM, Clint Hepner wrote:
>
>> On Jun 17, 2018, at 4:18 PM, Chris Angelico <rosuav at gmail.com> wrote:
>>
>>> On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V <mikhailwas at gmail.com> wrote:
>>> The idea is to introduce new syntax for the list.append() method.
>>>
>>>
>>> Syntax:
>>>
>>> Variant 1.
>>> Use special case of index, namely omitted index:
>>>
>>>     mylist[] = item
>> Creation of syntax cannot be done for just one type.
> That’s false. @ was added solely for matrix multiplication.
>
It was added for matrix multiplication, but any type that wants to use 
the feature can by implementing __matmul__ et al. It's not clear from 
Mikhail's proposal how types would opt into the append syntax.

Alex


More information about the Python-ideas mailing list