Re: Understanding def foo(*args)

2011-01-31 Thread Ben Finney
"Rob Richardson" writes: > My thanks both to the original poster and to JM for an excellent answer. > I saw this syntax for the first time recently, and I've been curious > about it too. Would it be correct of me to assume that you have not worked through the entire Python tutorial http://docs.p

RE: Understanding def foo(*args)

2011-01-31 Thread Rob Richardson
My thanks both to the original poster and to JM for an excellent answer. I saw this syntax for the first time recently, and I've been curious about it too. RobR -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding def foo(*args)

2011-01-31 Thread Jean-Michel Pichavant
sl33k_ wrote: Hi, I am struggling to grasp this concept about def foo(*args). Also, what is def bar(*args, *kwargs)? Isnt it like self must be the first parameter to the method/function? If not what are the exceptions? Also, can the terms method and function be used interchangeably? TIA "

Re: Understanding def foo(*args)

2011-01-30 Thread rusi
On Jan 31, 12:35 am, rantingrick wrote: > > Also, can the terms method and function be used interchangeably? > > Can the terms cars and truck be used interchangeably? Oooff! A load of meaning in that one line -- I wonder though if the OP will understand... -- http://mail.python.org/mailman/listi

Re: Understanding def foo(*args)

2011-01-30 Thread Ben Finney
sl33k_ writes: > I am struggling to grasp this concept about def foo(*args). Also, what > is def bar(*args, *kwargs)? Please work through the Python Tutorial from start to finish http://docs.python.org/tutorial/>, performing each exercise and experimenting with it until you understand. You will

Re: Understanding def foo(*args)

2011-01-30 Thread Ulrich Eckhardt
sl33k_ wrote: > Isnt it like self must be the first parameter to the method/function? "self" is just customary as first parameter to memberfunctions, the language itself doesn't impose this convention, as e.g. C++ does with its "this". > Also, can the terms method and function be used intercha

Re: Understanding def foo(*args)

2011-01-30 Thread Chris Rebert
On Sun, Jan 30, 2011 at 11:26 AM, sl33k_ wrote: > Hi, > > I am struggling to grasp this concept about def foo(*args). The interactive interpreter is your friend! Try experimenting with it next time! http://docs.python.org/tutorial/controlflow.html#arbitrary-argument-lists That `def` defines a va

Re: Understanding def foo(*args)

2011-01-30 Thread Mel
sl33k_ wrote: > Hi, > > I am struggling to grasp this concept about def foo(*args). Also, what > is def bar(*args, *kwargs)? > > Isnt it like self must be the first parameter to the method/function? > If not what are the exceptions? > > Also, can the terms method and function be used interchang

Re: Understanding def foo(*args)

2011-01-30 Thread rantingrick
On Jan 30, 1:26 pm, sl33k_ wrote: > Hi, > > I am struggling to grasp this concept about def foo(*args). Also, what > is def bar(*args, *kwargs)? FYI: the python intepretor is your friend! py> def foo(*args): print args py> foo(1) (1,) py> foo(1,2,3) (1, 2, 3) py> foo(1,[1,23], {'hat':

Re: Understanding def foo(*args)

2011-01-30 Thread sl33k_
Sorry that parameter is **kwargs. -- http://mail.python.org/mailman/listinfo/python-list