list vs tuple

Moshe Zadka moshez at zadka.site.co.il
Sat Mar 31 05:42:09 EST 2001


On Sat, 31 Mar 2001 10:01:16 GMT, "deadmeat" <root@[127.0.0.1]> wrote:

> Ooh, poor diddums got proven wrong. I blew the lid on your little baby.
> <cries>

You're proving yourself less knowledgable with every post.

> What python DOES is irrelevant

Of course. Completely irrelevant.

> The same
> statement (a = b) behaves entirely differently in each case.

The same statement behaves *exactly the same*. It's the next statements
(b[5] = 9, b = 9) that behave entirely differently. There are valid
arguments for not making = do such wildly different things (the Scheme
world occasionally get into these flamewars, only they spell = as set!)

b = 9 binds the variable
b[5] = 9 is equivalent to b.__setitem__(5, 9)

Fredrik's explanation makes sure to explain that *this* is the gotcha.
 
-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez at debian.org  |http://www.{python,debian,gnu}.org




More information about the Python-list mailing list