[New-bugs-announce] [issue13581] help() appears to be broken; doesn't display __doc__ for class type when called as help(type)

Christopher the Magnificent report at bugs.python.org
Sun Dec 11 19:26:28 CET 2011


New submission from Christopher the Magnificent <ultimate.mac.fanatic at gmail.com>:

observe help(type) and type.__doc__ in Python 3.1:


>>> help(type)
Help on class type in module builtins:

class type(object)
 |  type(object) -> the object's type
 |  type(name, bases, dict) -> a new type
 |  
 |  Methods defined here:
 |  
 |  __call__(...)
 |      x.__call__(...) <==> x(...)
 |  
 |  __delattr__(...)
 |      x.__delattr__('name') <==> del x.name
 |  
 |  __getattribute__(...)
 |      x.__getattribute__('name') <==> x.name
 |  
 |  __init__(...)
 |      x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 |  
 |  __instancecheck__(...)
 |      __instancecheck__() -> check if an object is an instance
 |  
 |  __repr__(...)
 |      x.__repr__() <==> repr(x)
 |  
 |  __setattr__(...)
 |      x.__setattr__('name', value) <==> x.name = value
 |  
 |  __subclasscheck__(...)
 |      __subclasschck__ -> check if an class is a subclass
 |  
 |  __subclasses__(...)
 |      __subclasses__() -> list of immediate subclasses
 |  
 |  mro(...)
 |      mro() -> list
 |      return a type's method resolution order
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __abstractmethods__
 |  
 |  __base__
 |  
 |  __bases__
 |  
 |  __basicsize__
 |  
 |  __dict__
 |  
 |  __dictoffset__
 |  
 |  __flags__
 |  
 |  __itemsize__
 |  
 |  __mro__
 |  
 |  __weakrefoffset__
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __new__ = <built-in method __new__ of type object at 0x145600>
 |      T.__new__(S, ...) -> a new object with type S, a subtype of T
 |  
 |  __prepare__ = <built-in method __prepare__ of type object at 0x145600>
 |      __prepare__() -> dict
 |      used to create the namespace for the class statement

>>> type.__doc__
"type(object) -> the object's type\ntype(name, bases, dict) -> a new type"
>>> 





observe help(type) and type.__doc__ in Python 3.2:



>>> help(type)
Help on class type in module builtins:

type = <class 'type'>
>>> type.__doc__
"type(object) -> the object's type\ntype(name, bases, dict) -> a new type"
>>> 



It appears that the __doc__ attribute of <class 'type'> is unchanged from Python 3.1 to 3.2, but it is not being displayed by the help function in Python 3.2.

The help function is very important to using Python!  This should be fixed.

----------
assignee: docs at python
components: Documentation, Interpreter Core
messages: 149234
nosy: christopherthemagnificent, docs at python
priority: normal
severity: normal
status: open
title: help() appears to be broken; doesn't display __doc__ for class type when called as help(type)
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13581>
_______________________________________


More information about the New-bugs-announce mailing list