A new to Python question
Steven Bethard
steven.bethard at gmail.com
Sat May 14 14:19:24 EDT 2005
M.E.Farmer wrote:
> (x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv)
> This will only create a tuple in memory that has no name to reference
> it by!
Huh? This binds the names "x", "y", "dotp", "sumx" and "maxv" to the
values returned by abc:
py> def abc(*args):
... return args
...
py> (x,y,dotp,sumx,maxv) = abc(2,3,5,7,11)
py> x
2
py> y
3
py> dotp
5
py> sumx
7
py> maxv
11
Of course, the parentheses around x,y,dotp,sumx,maxv are unnecessary.
STeVe
More information about the Python-list
mailing list