On Feb 15, 5:21 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> How can there be a structure datatype with an unpredictable
> number of members?
>
> It might have come across as a different question-sorry for any
> confusion.

This may be where the "tuple is like a struct" analogy isn't so good,
and "tuple is like a list but immutable" is better.

In both of your examples, the caller of f() sent a fixed list of
arguments: (1,2,3,4,5,6,7) in the first case and (8,9,10) in the
second.  Internally I bet the compiler wants to clean up that same
list of those same args when f() is finished.

Just as a thought experiment, do this for yourself.  Implement f as:

   def f(*args):
      args = list(args)
      print args

Now what is it you want to do with args that you can't do with it as a
tuple?  Do you want some form of communication back to the caller to
occur, for example?  Maybe some kind of pass-by-ref instead of pass-by-
value?

-- Paul




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

Reply via email to