"help( pi )"

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 19 16:49:41 EST 2017


Cameron Simpson wrote:
> Unless one had a misfortune and wanted another docstring.

Good point. I guess having differing docstrings should make
otherwise equal objects ineligible for merging.

>  mod1.py:
>    MAX_BUFSIZE = 8192
>    MAX_BUFSIZE.__doc__ = 'Size of the hardware buffer used for I/O on 
> this device.'
> 
>  mod2.py
>    DEFAULT_CACHESIZE = 8192
>    DEFAULT_CACHESIZE.__doc__ = 'Convenient size for the foo cache, not 
> to big or too small.'

I think setting the docstring of an existing immutable object
would have to be disallowed -- you need to create a new object
if you want it to have a distinct docstring, e.g.

MAX_BUFSIZE = int(8192, __doc__ = 'Size of the hardware buffer used for I/O on 
this device.')

-- 
Greg



More information about the Python-list mailing list