Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that *args and **kwargs are ways to feed more arguments into a function in Python.

I am wondering where these terms stem from. Why have all the asterisks in the beginning? What does the kw in kwargs stand for?

share|improve this question
What part of… is confusing? It seems very clear. Can you provide the specific words or phrases that confuse you? – S.Lott Jan 23 '12 at 19:51
@S.Lott What part of the documentation touches on the origin of the notation? – delnan Jan 23 '12 at 19:52
"What does the kw in kwargs stand for?" seems to be quite clearly defined. The "origin" for all of Python is either in a PEP (20%) or in the head of the BDFL (80%). – S.Lott Jan 23 '12 at 19:57
@root45: Please post your answer as an answer. – S.Lott Jan 23 '12 at 19:58
Thanks, and long live BDFL! – David Faux Jan 23 '12 at 20:10
up vote 8 down vote accepted

The "kw" stands for Key Word because the dictionary that you pass in is expanded to a sequence of key-word pair arguments. As to "Why have all the asterisks in the beginning?" I ask you, why not have them?

My hypothesis as to why the * characters were chosen is that they frequently have a wildcard meaning (e.g., in regular expressions or globing). This is just guess-work though and I have nothing to document that.

share|improve this answer
In C, they mean "pointer to", as in "indirect reference". Maybe that's why they were chosen. – S.Lott Jan 23 '12 at 20:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.