[Python-ideas] Operator for inserting an element into a list
mikhailwas at gmail.com
Fri Jun 15 20:23:49 EDT 2018
On Sat, Jun 16, 2018 at 3:02 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Jun 16, 2018 at 9:42 AM, Mikhail V <mikhailwas at gmail.com> wrote:
>> Now I have slightly different idea. How is about special-casing of this
>> as a shortcut for append:
>> L = item
>> Namely just use the fact that empty slice is SyntaxError now.
>> I understand this is totally different approach than operator
>> overloading and maybe
>> hard to implement, but I feel like it looks really appealing.
>> And it is quite intuitive imo. For me the syntax reads like:
>> "add new empty element and this element will be "item".
> Yes, if this were PHP.
Is it like that in PHP?
> I still haven't seen any compelling argument against the append
> method. -1 on introducing a new way to spell append.
By me - there is just nothing against append() method.
But I see from various posts in the web and SO - people
just want to spell it compact, and keep the 'item' part clean of
brackets. And that kind of makes sense.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
More information about the Python-ideas