x, = y (???)

Jonathan Gardner jgardner at jonathangardner.net
Thu Jul 17 22:02:57 CEST 2008


On Jul 17, 12:55 pm, kj <so... at 987jk.com.invalid> wrote:
> I still don't get it.  If we write
>
>   y  = 'Y'
>   x, = y
>
> what's the difference now between x and y?  And if there's no
> difference, what's the point of performing such "unpacking"?
>

Try:

  y = "abc"
  x, = y

You were unpacking y into ('Y',)



More information about the Python-list mailing list