[issue20226] Argument Clinic: support for simple expressions?
Larry Hastings
report at bugs.python.org
Wed Jan 15 04:40:43 CET 2014
Larry Hastings added the comment:
The attached patch extends Argument Clinic and the inspect module: now you may use simple (!) expressions as default values. So for example "sys.maxsize - 1" should now work fine.
* Names may be in the current module; as a backup they will also be looked up in sys.modules.
* You may look up attributes of names.
* You may subscript into names.
* You may use math operators, both unary and binary.
* int/float/string literals are (still) fine.
* You may not use: function calls, list/set/dict/tuple/bytes literals, generator expressions or comprehensions, if expressions, anything fun.
Other changes in this diff:
* "doc_default" is gone, it no longer makes sense.
* "py_default" and "c_default" handling is simpler and more predictable.
* Minor doc fix suggested on tracker.
The docs still need work. More tests would be good too but I'm already overwhelmed by work--could one of you guys contribute some tests?
----------
stage: -> patch review
type: -> enhancement
Added file: http://bugs.python.org/file33473/larry.clinic.rollup.patch.two.diff.1.txt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20226>
_______________________________________
More information about the Python-bugs-list
mailing list