[Tutor] why can you swap an immutable tuple?

Jim Mooney cybervigilante at gmail.com
Sun May 26 05:04:06 CEST 2013


On 25 May 2013 18:34, David <bouncingcats at gmail.com> wrote:

> On 26/05/2013, Jim Mooney <cybervigilante at gmail.com> wrote:
> > I thought tuples were immutable but it seems you can swap them, so I'm
> > confused:
> >
> > a,b = 5,8
>
> I think your confusion might arise from not understanding that the
> meaning of the comma differs depending on whether it is on the left or
> the right side of an equals sign.
>

I think the problem is the book I'm reading, which never mentions
"unpacking," so I thought from hearing a comma creates a tuple, that it was
tuples on both sides  ;')  I'm reading Learning Computer Science With
Python and I think it's scanting the Python-detail to get on with the
CompSci. I'll go look for something more PyDetailed ;')
-- 
Jim Mooney

"Coding? A woman can do that! he sneered" --heard from a physics professor
in 1969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130525/80555b3e/attachment.html>


More information about the Tutor mailing list