Steven D'Aprano wrote: > Consider this: > > def func(some_tuple): > > How many items should you pass in the tuple? If it takes variable > arguments, then that works, but if you always expect a fixed number, then > > def func((x, y)) > > is more explicit. > > The only problem I have is that once you unroll the tuple like that, it is > hardly necessary to pass the argument as a tuple. Why not just pass x and > y as two arguments? > > def func(x, y)
I generally agree with this (and follow the same guideline in my own APIs), but sometimes you don't have this option. If I have a class that I'd like to support an indexing operation like: obj[x, y] then the natural __getitem__ signature will look like: def __getitem__(self, (x, y)): ... STeVe -- http://mail.python.org/mailman/listinfo/python-list