return multiple values from fuction

Alex Martelli aleax at aleax.it
Thu Nov 6 15:24:52 EST 2003


Lupe wrote:

> hi, if someone can help me I would be grateful
> 
> when I do
> 
> def function

this needs of course to be

def function():

>         kjklj
>         llklç
>         
>         return variableA, variableB
> 
> how can I assign the two return values to two distinct variables, as for
> ex.
> 
> varC = variableA
> varD = variableB

"just do it":

varC, varD = function()


Alex





More information about the Python-list mailing list