<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
cite="mid1170247737.232403.114850@k78g2000cwa.googlegroups.com"
type="cite">
<pre wrap="">
It's bad practice to use built-ins like 'list' as a regular variable
name.
</pre>
</blockquote>
ok, but it was just an example (in practice, I always use very long
names ;-)<br>
<blockquote
cite="mid1170247737.232403.114850@k78g2000cwa.googlegroups.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap=""># calling method 1:
execute (S[0], S[4] )
# calling method 2:
execute ( ( S[0], S[4] ) )
</pre>
</blockquote>
<pre wrap=""><!---->
Let's take a look at those side-by-side:
execute (S[0], S[4] )
execute ( ( S[0], S[4] ) )
Now, which one *looks* better?
</pre>
<blockquote type="cite">
<pre wrap=""># or *the extra flexibility)
mylist = ( S[0], S[4] )
execute ( mylist )
</pre>
</blockquote>
<pre wrap=""><!---->
Also, take into consideration the opposite end of the pole; you have
your list of arguments (args), and your about to call a function that
was declared something like this:
def someFunction(arg1, arg2, arg3):
# etc.
Which is clearer?
someFunction(*args)
someFunction(args[0], args[1], args[2])
And if you've got a variable number of arguments, it becomes virtually
impossible to avoid using the *args syntax.
</pre>
</blockquote>
# So with this construct, I have all flavours:<br>
<br>
def chunk_plot(*args):<br>
if len(args)==1: my_example_var = args[0]<br>
else: my_example_var = args<br>
for i in range ( len ( my_example_var ) ):<br>
... do something with my_example_var [i]<br>
<br>
# calling the procedure<br>
chunk_plot (S[1], S[4])<br>
chunk_plot ( ( S[1], S[4] ) )<br>
my_action_list = ( S[1], S[2] )<br>
chunk_plot ( my_action_list )<br>
<br>
<br>
And sorry, no need for kwargs for now ;-)<br>
<br>
thanks guys,<br>
Stef<br>
</body>
</html>