__setitem__ puzzle

Alex Martelli aleax at aleax.it
Mon Apr 21 12:11:16 EDT 2003


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).


Alex





More information about the Python-list mailing list