what exactly you want to do by
<code>
    [1,2,3] = "Anything"
</code>

the above code is called unpacking of sequence, so there must be some
variable on left side of assignment operator.
but you have list of integers, why?


On Tue, Jul 23, 2013 at 11:15 PM, Don Jennings <dfjenni...@gmail.com> wrote:

>
> On Jul 21, 2013, at 10:26 PM, Amandeep Behl wrote:
>
> >
> >
> > def Move(label):
> >   label = "Anything"
> >
> > a_list = [1,2,3]
> > Move(a_list)
> >
> > I don't see any error when executing above but  when i manually assign
> [1,2,3] = "Anything" i get error
> >  Why?
>
> Repeat after me:  label is a name, label is a name, label is a name ;>)
>
> So, you misunderstand what is happening in your code. Your function
> accepts the argument named "label", but you do nothing with the object (a
> list of numbers in this case). Instead, you use the same name and assign it
> to the string object "Anything".
>
> Assignment works by assigning a name (on the left side of the operator),
> to an object on the right side.
>
> Take care,
> Don
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to