__setitem__ puzzle

Anton Vredegoor anton at vredegoor.doge.nl
Mon Apr 21 22:20:19 CEST 2003


"Terry Reedy" <tjreedy at udel.edu> wrote:

>As Aahz correctly said, you should specify what l[tuple] is supposed
>to mean.

Probably, yes. But I didn't want to kill too many alternative
outcomes.

>Reading code and usage reveals the intention that
>l[(a,b,c)]==l[a][b][c], etc.

Yes. I couldn't believe that there wasn't a conversion function for
this in the standard distribution. Maybe there is, I still have a hard
time believing it.

>The solution is to directly do what you tried to do indirectly by
>making the copy.
>This also works with tlists as sublists.

This is appreciated very much! Please excuse my antinomic presentation
of the puzzle.

Anton






More information about the Python-list mailing list