2

Possible Duplicate:
*args and **kwargs?

I know the structure *var

def fn(*var):
  pass

which if the analoguous of . var of scheme or va_args of c.

Now I met the amazing structure

def fn(**list):
  pass

which is useful to pass to fn the names of variables and values, as a dictionary (with no analogous in scheme).

Is there some structure in python with 3 asterisks ?

def fn (***variable)

What is the general meaning of asterisk + variable in python ?

Community
  • 1
  • 1
alinsoar
  • 15,386
  • 4
  • 57
  • 74

1 Answers1

2

In Python, * and ** have specific meanings, just as you describe. There is no *** and no general rule that applies to the number of asterisks.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Could you explain what they are? I'd love to know since I only dabble in Python. – Sled Dec 25 '12 at 18:39
  • 1
    @ArtB: The best reference is the Python documentation itself, section [5.3.4 Calls](http://docs.python.org/2/reference/expressions.html#calls). – Greg Hewgill Dec 25 '12 at 18:46
  • 1
    **tl;dr** Arguments passed with `*` are passed via an anonymous tuple, and arguments passed with `**` are passed via an anonymous map. – Sled Dec 27 '12 at 16:49