New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help() appears to be broken; doesn't display __doc__ for class type when called as help(type) #57790
Comments
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: >>> 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. |
It fails for the same reason as bpo-1785: ~/python/cpython3.2$ ./python -c "import inspect; inspect.classify_class_attrs(type)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/amauryfa/python/cpython3.2/Lib/inspect.py", line 321, in classify_class_attrs
obj_via_getattr = getattr(cls, name)
AttributeError: __abstractmethods__ |
New changeset 902f694a7b0e by Antoine Pitrou in branch '3.2': New changeset b08bf8df8eec by Antoine Pitrou in branch 'default': |
New changeset 13f56cd8dec1 by Antoine Pitrou in branch '2.7': |
Now fixed in all 3 branches. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: