<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 4, 2014 at 2:10 PM, Stefano Borini <span dir="ltr"><<a href="mailto:stefano.borini@ferrara.linux.it" target="_blank">stefano.borini@ferrara.linux.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":44i" class="" style="overflow:hidden">I just added a new strategy. This one cuts the problem down.<br>
<br>
Strategy 4: Strict dictionary</div></blockquote></div><br>Did anyone consider treating = inside [] in a similar way as : is treated now. One can even (re/ab)use the slice object:</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">a[1, 2, 5:7, Z=42] -> a.__getitem__((1, 2, slice(5, 7, None), slice('Z', '=', 42)))</div><div class="gmail_extra"><br></div><div class="gmail_extra">This strategy would also offer a semi-readable back-porting solution:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">>>> class C:</div><div class="gmail_extra">... def __getitem__(self, key):</div><div class="gmail_extra">... print(key)</div>
<div class="gmail_extra">...</div><div class="gmail_extra">>>> c = C()</div><div class="gmail_extra">>>> c['Z':'=':42]</div><div class="gmail_extra">slice('Z', '=', 42)</div>
</div></div>