On Tue, Jun 12, 2018 at 11:08 AM Mikhail V <mikhail...@gmail.com> wrote:

> On Tue, Jun 12, 2018 at 7:42 PM, Clint Hepner <clint.hep...@gmail.com>
> wrote:
>
> So the idea was about an insert/append operator.
> Which would use augmented operator. The operator may be
> /= or ^=. (I like ^= more, so I'll put here example with it).
>

The "/" operator means divide. How do you divide a list?
The "^" operator means exclusive-or. Again, strange concept for a list.

Yes, there are examples of Python (mis)using operators like "%" for string
interpolation. Note the difficulties that caused; we now have 3 ways to
interpolate. It looked cool at the time, but happily we have f-strings now.


> L += var
> and
> L = L + var
>
> are different, so it seems to me they were not meant to be
> bound together.
>

One is mutation, the other isn't, but aside from that, the result is
equivalent.


> If the intention is to insert an element, indeed it is confusing, for
> me at least:
>
>     L[0:0] = "bb"
> -> ["b","b","aa"]
>

Thats, like, just your opinion, Man. Kidding aside, I think you'll find
it's natural once you get used to slice assignment. The slice assignment
iterates over the right-hand argument and inserts each element. It
overwrites the existing slice if any.

In this example, you've mixed issues. It looks like you've gotten confused
by string iteration. When you loop a string, you get 1-len strings.
_______________________________________________
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