why?

bradh at cuneata.net bradh at cuneata.net
Mon Dec 2 19:16:42 EST 2002


Quoting bradh at cuneata.net:

> Quoting Brian Quinlan <brian at sweetapp.com>:
> > > You can, if you say doing[1] = ('i') which to my (very newbie) 
> > > thinking is assignment of a tuple to a string. I can't see how 
> > > it is more valid to assign a tuple to a string, rather than a 
> > > string to a string.
> > 
> > This is your conceptual problem. Why do you think it matters what
> > doing[1] used to be? It doesn't. 
> 
> OK, so doing[1] is really just a reference. And we can move the 
> reference around to be a reference to a tuple.
> 
> But that doesn't really explain why I can't assign a string to
> doing[1].
> Or why the OP can't do the assignment :)
Argh. Mistake of the return vs delete key.

I understand what is happening now. For some reason the first time I tried
it, I did the tuple assignment and only got back ['a', 'b', 'c'], instead
of ['a', ('b', 'c'), 'c').

All is now clear :)

Brad




More information about the Python-list mailing list