Is there a better way to code variable number of return arguments?

Simon Forman sajmikins at gmail.com
Fri Oct 9 00:15:59 EDT 2009


On Thu, Oct 8, 2009 at 7:14 PM, Dr. Phillip M. Feldman
<pfeldman at verizon.net> wrote:
>
> I'm amazed that this works.  I had not realized that
>
> x,y= [3,4]
>
> is equivalent to
>
> x= 3; y= 4
>
> Python is rather clever.
>
> Thanks!
>

Python is very clever:

>>> (a, b), c = (1, 2), 3
>>> a, b, c
(1, 2, 3)

:D



More information about the Python-list mailing list