This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients larry, mark.dickinson, r.david.murray, terry.reedy
Date 2012-12-29.03:35:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356752115.32.0.65618043229.issue16801@psf.upfronthosting.co.za>
In-reply-to
Content
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."
History
Date User Action Args
2012-12-29 03:35:15larrysetrecipients: + larry, terry.reedy, mark.dickinson, r.david.murray
2012-12-29 03:35:15larrysetmessageid: <1356752115.32.0.65618043229.issue16801@psf.upfronthosting.co.za>
2012-12-29 03:35:15larrylinkissue16801 messages
2012-12-29 03:35:14larrycreate