[Tutor] Functions returning multiple values

Giorgio anothernetfellow at gmail.com
Sun Feb 21 17:00:32 CET 2010


Hi,

do you know if there is a way so that i can get multiple values from a
function?

For example:

def count(a,b):
 c = a + b
 d = a - b

How can I return the value of C and D?

Then, i have another question: i've read, some time ago, this guide
http://hetland.org/writing/instant-python.html, skipping the object-related
part. Now i've started reading it, and have found something strange: just go
where it says "Of course, now you know there is a better way. And why don’t
we give it the default value of [] in the first place? Because of the way
Python works, this would give all the Baskets the same empty list as default
contents.". Can you please help me understanding this part?

Thankyou

Giorgio



-- 
--
AnotherNetFellow
Email: anothernetfellow at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100221/c4196fd6/attachment.html>


More information about the Tutor mailing list