pydoc in 2.1: Missing static methods

Skip Montanaro skip at pobox.com
Mon Oct 8 15:41:03 EDT 2001


    Franz> I use pydoc of ActivePython 2.1.212 and am pretty happy with it,
    Franz> except when it comes to "static methods": Such methods are not
    Franz> shown by pydoc!
    ...
    Franz> Any ideas?

Fixed in 2.2 which has both staticmethod() and classmethod() builtins,
effectively rendering Alex's static method implementation unnecessary:

    % python
    Python 2.2a4+ (#4, Oct  8 2001, 09:49:18) 
    [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> class foo:
    ...   def bar(x,y):
    ...     pass
    ...   bar = staticmethod(bar)
    ... 
    >>> help(foo)
    Help on class foo in module __main__:

    class foo
     |  Static methods defined here:
     |  
     |  bar(x, y)
     |  
     |  ----------------------------------------------------------------------
     |  Data and non-method functions defined here:
     |  
     |  __doc__ = None
     |  
     |  __module__ = '__main__'

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list