Re: How to access args as a list?

2010-04-05 Thread kj
In 4bb802f7$0$8827$c3e8...@news.astraweb.com Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 03 Apr 2010 22:58:43 +, kj wrote: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to

Re: How to access args as a list?

2010-04-05 Thread Steve Howell
On Apr 5, 11:49 am, kj no.em...@please.post wrote: In 4bb802f7$0$8827$c3e8...@news.astraweb.com Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 03 Apr 2010 22:58:43 +, kj wrote: Suppose I have a function with the following signature: def spam(x, y, z):     #

Re: How to access args as a list?

2010-04-04 Thread Francesco Bochicchio
On 4 Apr, 00:58, kj no.em...@please.post wrote: Suppose I have a function with the following signature: def spam(x, y, z):     # etc. Is there a way to refer, within the function, to all its arguments as a single list?  (I.e. I'm looking for Python's equivalent of Perl's @_ variable.)

How to access args as a list?

2010-04-03 Thread kj
Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm looking for Python's equivalent of Perl's @_ variable.) I'm aware of locals(), but I want to preserve the

Re: How to access args as a list?

2010-04-03 Thread Andreas Waldenburger
On Sat, 3 Apr 2010 22:58:43 + (UTC) kj no.em...@please.post wrote: The best I have managed looks like this: class _Spam(object): def __init__(self, x, y, z): self.__dict__ = OrderedDict(()) for p in inspect.getargspec(_Spam.__init__).args[1:]:

Re: How to access args as a list?

2010-04-03 Thread Tim Chase
kj wrote: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm looking for Python's equivalent of Perl's @_ variable.) It sounds like you want the * operator

Re: How to access args as a list?

2010-04-03 Thread MRAB
kj wrote: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm looking for Python's equivalent of Perl's @_ variable.) I'm aware of locals(), but I want to

Re: How to access args as a list?

2010-04-03 Thread Rolando Espinoza La Fuente
On Sat, Apr 3, 2010 at 6:28 PM, kj no.em...@please.post wrote: Is there a way to refer, within the function, to all its arguments as a single list?  (I.e. I'm looking for Python's equivalent of Perl's @_ variable.) def spam(*args, **kwargs): print args print kwargs class Spam:

Re: How to access args as a list?

2010-04-03 Thread kj
In hp8h73$k1...@reader1.panix.com kj no.em...@please.post writes: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm looking for Python's equivalent of Perl's @_

Re: How to access args as a list?

2010-04-03 Thread kj
In hp8kc9$dg...@reader1.panix.com kj no.em...@please.post writes: In hp8h73$k1...@reader1.panix.com kj no.em...@please.post writes: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a

Re: How to access args as a list?

2010-04-03 Thread Andreas Waldenburger
On Sat, 3 Apr 2010 23:52:42 + (UTC) kj no.em...@please.post wrote: In hp8h73$k1...@reader1.panix.com kj no.em...@please.post writes: [snip] P.S. this is just an example; the function I want to implement has more parameters in its signature, with longer, more informative names.

Re: How to access args as a list?

2010-04-03 Thread Grant Edwards
On 2010-04-03, kj no.em...@please.post wrote: In hp8h73$k1...@reader1.panix.com kj no.em...@please.post writes: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm

Re: How to access args as a list?

2010-04-03 Thread Steven D'Aprano
On Sat, 03 Apr 2010 22:58:43 +, kj wrote: Suppose I have a function with the following signature: def spam(x, y, z): # etc. Is there a way to refer, within the function, to all its arguments as a single list? (I.e. I'm looking for Python's equivalent of Perl's @_ variable.)