Integers have docstring for int()

Skip Montanaro skip at pobox.com
Wed Aug 11 11:02:20 EDT 2004


    Andrew> I accidentally discovered that all the basic types in Python
    Andrew> have docstrings that describe the functions to create them. For
    Andrew> integers, you get:
    ...

    Andrew> This seems a little unexpected to me; is there any particular
    Andrew> reason for this behaviour?

Why should this be unexpected?  If you execute

    print int.__doc__

you get its docstring.  Since the __doc__ attribute is attached to the class
it will be found when the search starts at an instance of the class as well.

Skip



More information about the Python-list mailing list