How to access args as a list?

Rolando Espinoza La Fuente darkrho at
Sat Apr 3 19:21:38 EDT 2010

On Sat, Apr 3, 2010 at 6:28 PM, kj < at> 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:
    def __init__(self, *args, **kwargs):
        print args
        print kwargs

That's what are you looking for?



More information about the Python-list mailing list