Larry Hastings added the comment:

Okay, counter-proposal time.  We add a new field to the Parameter object, the 
preferred string representation of the default.  If the parameter has a 
default, it is always a string, by default repr(parameter_default_value); if 
the parameter has no default then it is None.

You can then override the default:

    @inspect.use_original_representation('mode')
    def open(file, flag='r', mode=0o666):

And if os.open were supplied in os.py:

    @inspect.override_string_representation('mode',
        'os.O_CREAT | os.O_RDWR')
    def open(file, flags, mode=0o777, *, dir_fd=None):

(p.s. I know the mode argument there is wrong, it has a million things in it 
and this is just to get the idea across.)

Then the docstring generator, IDLE, etc. would be told "Please use this new 
field of the Parameter object when displaying the default to the user."

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16801>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to