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
__doc__ strings of builtin types #36520
Comments
pydoc creates a strange description for the __doc__ C:\>c:\sf\python\dist\src\PCBuild\python.exe
Python 2.3a0 (#29, Apr 15 2002, 18:33:31) [MSC 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> class O(object):
... "some text"
...
>>> import pydoc
>>> pydoc.help(O)
Help on class O in module __main__: class O(__builtin__.object)
| some text
|
| Data and non-method functions defined here:
|
| __dict__ = <dict-proxy object at 0x0080D410>
|
| __doc__ = 'some text'
| str(object) -> string
|
| Return a nice string representation of the object.
| If the argument is a string, the return value
is the same object.
| The attached patch prints the following (also for the |
Logged In: YES The same problem exists for the __module__ attribute. I can |
Logged In: YES Please ignore my previous comments. It turns out that the problem is not in pydoc, it is in The side-effect is that pydoc prints unexpected output for class X:
a = "a string"
b = 42
import pydoc
pydoc.help(X) |
1 similar comment
Logged In: YES Please ignore my previous comments. It turns out that the problem is not in pydoc, it is in The side-effect is that pydoc prints unexpected output for class X:
a = "a string"
b = 42
import pydoc
pydoc.help(X) |
Logged In: YES The instance doc is supposed to be the same as the class I suppose the str() __doc__ is not particularly appropriate Can you suggest a better wording? (This problem is |
Logged In: YES No, I cannot think of a better wording. |
Logged In: YES Or maybe add a __doc__ tp_member (or whatever) which always |
Logged In: YES The attatched patch (stringobject.diff) implements this |
Logged In: YES Since this would also go into int, float, and other places, |
Logged In: YES I'm very sympathetic, but have no time to review this just |
Logged In: YES I think there are actually two issues here: pydoc shows the For the pydoc issue, I have a different patch For the other issue, I'm not sure *what* to do. Tim suggests |
Logged In: YES
|
Logged In: YES
Oops, here's pydoc2.diff
Maybe, but aren't there lots of these? Maybe this ought to
That's what I realized after looking at your string patch. Raymond, do you want to work on finishing this? |
Logged In: YES Guido, after applying pydoc2.diff I'm happy. I retract |
Logged In: YES OK, I've checked in pydoc2.diff. I'm not sure if we need to do anything about the docstrings |
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: