I understand the view from the poster, most basic list operations are using 
brackets, ie reading and writing with [], delete with del L[], why not append ?
And being used extensively, that brackets are annoying.
And yes, += [] is more "concise" than .append() so some people would think it's 
more clear because "it's smaller" (they'd be wrong as the OP mentioned).

But it would break the "There is only one Obvious way to do it" principle.
People would take time to figure out "okay, what should I write ? What's the 
most Pythonic ?"

If someone wants to use their own list class, it's doable with the current 
syntax :

class List(list):
    def __lshift__(self, x):
        self.append(x)
        return self

a = List([1,2,7,2])
a = a << 1 << 5
a <<= 0

2018-06-18 1:36 GMT+02:00 Clint Hepner 
<clint.hep...@gmail.com<mailto:clint.hep...@gmail.com>>:


> On Jun 17, 2018, at 4:18 PM, Chris Angelico 
> <ros...@gmail.com<mailto:ros...@gmail.com>> wrote:
>
>> On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V 
>> <mikhail...@gmail.com<mailto:mikhail...@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.

>
> Regardless, I am still a strong -1 on introducing another way to spell
> list.append().

-1 as well. Has any one but the proposer shown any support for it yet?

—
Clint

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org<mailto:Python-ideas@python.org>
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to