◐ Shell
clean mode source ↗

Message 208135 - Python tracker

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?