En Tue, 08 Apr 2008 01:57:47 -0300, Jason Scheirer  
<[EMAIL PROTECTED]> escribió:

> You want to
> return s, t
> NOT return (s, t) -- this implicitly only returns ONE item

To avoid confusing the poor newbie: No, they're absolutely the same thing,  
in both cases you're returning a tuple with two items:

py> def f():
...   return 1, 2
...
py> def g():
...   return (1, 2)
...
py> f()
(1, 2)
py> g()
(1, 2)
py> a, b = f()
py> c, d = g()
py> c
1
py> d
2

When one says that a function like those above returns "two things",  
actually it means that the function returns "a tuple with two elements",  
not two separate objects.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to