S
Steven D'Aprano
I do have one more thing to point out, which is that currently the
Python vararg syntax is very difficult to Google for.
You're coming in late to the conversation, but that was literally the
second thing pointed out by the original poster:
Throwing an idea for a PEP out there:
It strikes me that the def func(*args, **kwargs) syntax is rather
unpytonic. It certainly did not have that 'for line in file'
pythonic obviousness for me as a beginner. Plus, asterikses are
impossible to google for, so finding out what exactly they do more
or less forces you to write a forum post about it.
And rebutted. Modesty[1] prevents me from quoting myself, but here are
some links to searches:
http://duckduckgo.com/?q=python+asterisk
http://duckduckgo.com/?q=python+*
My normal first place to look for something is Wikipedia. Enjoy it before
SOPA kills it.
http://en.wikipedia.org/wiki/Asterisk#Programming_languages
In the first pages
of the four searches matching "python (function)? (star | asterisk)",
Your search looks overly complicated to me.
I'm not an expert on Google's syntax, but if you search for "python,
optionally with function", isn't that the same as just searching for
"python" since it will return hits either with or without "function"?
I certainly remember having a small amount of difficulty figuring out
what the heck * and ** did the first time I encountered them.
Answering that sort of question is what the interactive interpreter
excels at. Suppose you see a function declared with *args as an argument,
and you have no idea what it means. Try it and find out!
py> def spam(*args):
.... print(args, type(args))
....
py> spam(42)
((42,), <type 'tuple'>)
py> spam(42, 23)
((42, 23), <type 'tuple'>)
Never underestimate the power of Python's introspection tools, especially
the two simplest ones: print and type. Often you will learn more in 10
minutes experimentation than in an hour googling.
[1] Eh, who am I fooling?