faucheuse wrote:
Hi, (new to python and first message here \o/)

I was wondering something :
when you do : return value1, value2, value3
It returns a tuple.

So if I want to pass these value to a function, the function have to
look like :
def function(self,(value1, value2, value3)) #self because i'm working
with classes

I tried it, and it works perfectly, but I was wondering if it's a good
choice to do so, if there is a problem by coding like that.

So my question is : Is there a problem doig so ?
There is no problem with that but ppl will usually write something like:

def function(self, a3Tuple):
   v1, v2 ,v3 = a3Tuple

In a general manner, ppl will tend to use the minimum arguments required. However, do not pack values into tuple if they are not related. A better thing to do would be to use objects instead of tuples, tuples can serve as lazy structures for small application/script, they can become harmful in more complexe applications, especialy when used in public interfaces.

JM


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

Reply via email to