arbitrary number of arguments in a function declaration

rbt rbt at athop1.ath.vt.edu
Sun Jan 2 14:18:18 EST 2005


How do I set up a function so that it can take an arbitrary number of 
arguments? For example, I have a bunch of expenses which may grow or 
shrink depending on the client's circumstance and a function that sums 
them up... hard coding them is tedious. How might I make this dynamic so 
that it can handle any amount of expenses?

def tot_expenses(self, e0, e1, e2, e3):
     pass



More information about the Python-list mailing list