21 Jul
2010
21 Jul
'10
12:51 a.m.
I'm not sure what this is about but do you mean something like this?
l=[1,2,3,4] l[1:2] = ['a','b'] l [1, 'a', 'b', 3, 4]
On 07/20/2010 09:17 PM, Bruce Leban wrote:
[changing the subject; was: 'where' statement in Python?]
I think this is an interesting idea (whether worth adding is a different question). I think it would be confusing that a[x] = (y,z) does something entirely different when x is 1 or (1,2). If python *were* to add something like this, I think perhaps a different syntax should be considered:
a[[x]] = y y = a[[x]]
which call __setitems__ and __getitems__ respectively. This makes it clear that something different is going on and eliminates the ambiguity for dicts.