On Thu, Jun 14, 2018 at 12:40 AM, Mikhail V <mikhail...@gmail.com> wrote: > On Wed, Jun 13, 2018 at 5:13 PM, Chris Angelico <ros...@gmail.com> wrote: >> On Thu, Jun 14, 2018 at 12:04 AM, Mikhail V <mikhail...@gmail.com> wrote: >>> On Wed, Jun 13, 2018 at 2:15 AM, Greg Ewing <greg.ew...@canterbury.ac.nz> >>> wrote: >>>> Mikhail V wrote: > >>> Sorry for repeating myself, the idea was that the default meaning is >>> append(), >>> i.e. normal operator usage on list: >>> >>> L1 = L2 ^ item - would be same as >>> L1 = L2.append(item) >> >> Not sure exactly what your intention here is, because list.append >> mutates the list and returns None. Does "L2 ^ item" mutate L2 in >> place, or does it construct a new list? If it mutates in place, does >> it return the same list? Or if doesn't, how is it different from "L2 + >> [item]", which is a much more logical spelling of list addition? > > I made wrong example again. So > > L1 = L2 ^ item > is > L1 = L2 + [item] > > and > L ^= item > is > L.append(item) > or > L += [item]
Okay. Now it all is coherent and makes perfect sense... but you're offering alternative spellings for what we can already do. The only improvement compared to the + operator is that you don't need to surround the operand in brackets; in return, it's less general, being unable to add multiple elements to the list. The only improvement compared to .append is that it's an operator. There's no connection to exclusive-or, and there's not a lot of "but it's intuitive" here (cf Path division). ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/