<font class="Apple-style-span" face="'courier new', monospace">    x = a[[y]]</font><div>would be approximately equivalent to</div><div><font class="Apple-style-span" face="'courier new', monospace">    x = [a[i] for i in y]</font></div>

<div>and</div> <font class="Apple-style-span" face="'courier new', monospace">   a[[x]] = y</font><div>would be approximately equivalent to</div><div><font class="Apple-style-span" face="'courier new', monospace">    for (i,j) in zip(x,y): a[i] = j</font></div>

<div>except that zip throws away excess values in the longer sequence and I think <font class="Apple-style-span" face="'courier new', monospace">[[..]]</font> would throw an exception.</div><div><br clear="all">--- Bruce<br>

<a href="http://www.vroospeak.com" target="_blank">http://www.vroospeak.com</a><br><a href="http://google-gruyere.appspot.com" target="_blank">http://google-gruyere.appspot.com</a><br><br>
<br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 3:51 PM, Mathias Panzenböck <span dir="ltr"><<a href="mailto:grosser.meister.morti@gmx.net">grosser.meister.morti@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I'm not sure what this is about but do you mean something like this?<br>
>>> l=[1,2,3,4]<br>
>>> l[1:2] = ['a','b']<br>
>>> l<br>
[1, 'a', 'b', 3, 4]<div class="im"><br>
<br>
On 07/20/2010 09:17 PM, Bruce Leban wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[changing the subject; was: 'where' statement in Python?]<br>
<br>
I think this is an interesting idea (whether worth adding is a different question). I think it would<br>
be confusing that<br>
    a[x] = (y,z)<br>
does something entirely different when x is 1 or (1,2). If python *were* to add something like this,<br>
I think perhaps a different syntax should be considered:<br>
<br>
a[[x]] = y<br>
y = a[[x]]<br>
<br>
which call __setitems__ and __getitems__ respectively. This makes it clear that something different<br>
is going on and eliminates the ambiguity for dicts.<br>
</blockquote></div><div><div></div><div class="h5">
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div>