__setitem__ puzzle

Alex Martelli aleax at aleax.it
Sat May 3 05:37:04 EDT 2003


Steve Holden wrote:

> "Alex Martelli" <aleax at aleax.it> wrote in message
> news:EKUoa.67108$T34.1782963 at news2.tin.it...
>> Anton Vredegoor wrote:
>>
>> > I have subclassed the builtin list type to accept tuples for indexing.
>>
>> ...apparently to deal with nested lists, if I read you right.  I don't
>> like that; I've long thought that L[seq] should be [L[x] for x in seq],
>> and L[seq]=seq1 should be like
>>
>>     for i, v in zip(seq, seq1): L]i] = v
>>
>> with the added constraint that len(seq) == len(seq1).
>>
> So, why isn't it?

Because AFAIK the BDFL doesn't agree -- perhaps because the above mentioned
list comprehension and loop may be considered to suffice, and/or the risks
of confusion in L[1,2,3] NOT meaning "multidimensional addressing" when L
is a list (while it does mean multidimensional addressing when L is a 
Numeric.array) are deemed to be a problem.


Alex





More information about the Python-list mailing list