<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jun 18, 2018 at 5:52 PM Juancarlo Añez <<a href="mailto:apalala@gmail.com">apalala@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The idea is to introduce new syntax for the list.append() method.<br><br>
    mylist[] = item<br></blockquote></div><div class="gmail_extra"><br></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_extra">For all practical purpose, it would be enough to define that the expression:</div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_extra">mylist += [item]</div></div></blockquote><div class="gmail_extra"><div class="gmail_extra">gets optimized to mylist.append(item).</div></div></div></blockquote><div><br></div><div>Unfortunately, that would create yet another special case of operators breaking the rules. Most operators invoke magic methods. This would prevent ``+=`` from invoking ``__iadd__`` for lists, since the right-hand side would need to be compiled differently. It's similar to why ``and`` and ``or`` keywords can't have magic methods.</div></div></div>