[Python-ideas] keyword arguments everywhere (stdlib) - issue8706
Gregory P. Smith
greg at krypto.org
Fri Mar 2 08:52:05 CET 2012
Something I'd like to bring up at the language summit next week if we have
time (suggestion: limit it to 20 minutes), lets start discussion now:
1) Should _*all_* Python base types support keyword arguments on all of
2) Should _*all_* stdlib extension modules support keyword arguments on all
of their functions and methods?
Assumptions: any newly supported keyword arguments would have meaningful
names (and the documentation updated to reflect their name).
How should "_*all_*" be defined in each of the above.
One example against _*all_* is trivial single-argument functions such as
One example for is the str.find method's start parameter being more obvious
An example of a rule of thumb that could be proposed:
* All optional arguments should also be accepted as keywords.
* Any public function or method that require multiple arguments should
accept them as keywords.
Why propose this? For consistency and to promote readable code. A
reasonably often heard complaint from people new to Python that I have
heard is how some things work as keyword arguments and some don't. Pure
Python code can't (easily without gross hacks) be written to refuse to
accept keyword arguments, the standard types and library should not be
Documentation and docstrings have at times been inconsistent in the past
with respect to what they call arguments and would be cleaned up as part of
this to match the actual keyword argument accepted (that is worth doing on
its own even without changing what the code accepts).
A decision with discussion notes on this may be PEP worthy.
for reference - this is http://bugs.python.org/issue8706
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas