"help( pi )"

Marko Rauhamaa marko at pacujo.net
Fri Nov 17 10:52:37 EST 2017


Paul Moore <p.f.moore at gmail.com>:
> numbers don't have docstrings.

There's no reason they couldn't:

   >>> help(2)

   Help on built-in number 2 in module builtins:

   2
      2 -> int

      The natural number immediately succeeding 1 (qv). The number of
      hemispheres in a healthy mammal's brain.

It might also be useful to define a __docstr__() method for cases where
a static __doc__ string is unwieldy. Then, the class could construct the
doc string for its objects.


Marko



More information about the Python-list mailing list