f---ing typechecking

Paul Rubin http
Thu Feb 15 18:21:55 EST 2007


Donn Cave <donn at u.washington.edu> writes:
> If t is a valid argument tuple for function f, then can t[1:]
> also be a valid argument tuple for function f?
> 
> For ordinary functions without special argument handling, no.
> We know that without having to know anything about t, and not
> much about f.  This is characteristic of tuple applications.

I'm not sure what you're saying.  The current situation is if I say

   def f(*args):
      print args
   
   f (1,2,3,4,5,6,7)

f receives a 7-element tuple, but if I say

  f (8, 9, 10)

f receives a 3-element tuple.

I'm asking whether f should receive a list instead.  I think that is
more in keeping with the notion of a tuple being like a structure
datatype.  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.



More information about the Python-list mailing list