[issue16801] Preserve original representation for integers / floats in docstrings
Terry J. Reedy
report at bugs.python.org
Sat Dec 29 06:35:20 CET 2012
Terry J. Reedy added the comment:
If you wish to pursue this, I suggest starting with 'the simplest thing that works' for the text cases at hand. They all involve 'mode' and you have not presented and I cannot think of other cases. So somewhere in the signature generation code:
if function name in <set> and parameter_name == 'mode':
replace_decimal_with_octal(parameter_default)
If more generality is really needed, pick a new reserved attribute for functions and set it at the time of definition.
def open(file, flag='r', mode=0o666):
open.__param_rep__ = {'mode': 'octal'} #or whatever is chosen
I suppose the advantage of adding the syntactic sugar of a decorator, after getting the above to work, is that the doc could be hidden away in the inspect model, where is would be easily ignored.\
Still, this does seem like a lot of 'noise' for a small bit of extra 'signal' increment.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16801>
_______________________________________
More information about the Python-bugs-list
mailing list