On Thu, Jul 17, 2008 at 2:55 PM, kj <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]> Erik Max Francis <[EMAIL PROTECTED]> writes: > >>kj wrote: > >>> I just came across an assignment of the form >>> >>> x, = y >>> >>> where y is a string (in case it matters). >>> >>> 1. What's the meaning of the comma in the LHS of the assignment? > >>It's unpacking a 1-tuple: > >> (x,) = y > >>The parentheses here are not necessary and are sometimes left out. > > 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"? > > TIA!
>>> y = (1,) >>> y (1,) >>> x, = y >>> x 1 >>> -- http://mail.python.org/mailman/listinfo/python-list