-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
help()
on types has strange (if defined)
notice for attributes that are defined
#112266
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
Comments
What it's trying to say is that there might not be any instance variables defined, i.e., |
I guess that "if defined" refers not to |
I personally find the current text clear, but I'm a native English speaker, and it's true that the current text is very terse. If the current text isn't clear to non-native English speakers, then I agree we should change it to something that is. I actually quite like @sobolevn's idea of just removing the "(if defined)". I'm not sure it adds anything; if it's unclear to some people, let's just get rid of it |
Context: while working on #112143 I've spent like 20 minutes debugging After the change: >>> class A: ...
...
>>> help(A)
Help on class A in module __main__:
class A(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object |
…akref__` docstrings
…akref__` docstrings
I agree with the change. |
…akref__` docstrings (pythonGH-112268) (cherry picked from commit f812914) Co-authored-by: Nikita Sobolev <[email protected]>
…d `__weakref__` docstrings (pythonGH-112268)
…akref__` docstrings (python#112268)
…akref__` docstrings (python#112268)
Feature or enhancement
Let's say we have a regular class and we call
help()
on it:This leaves a strange impression: what does it mean for
__dict__
?It is defined.
The same for regular
__doc__
:Let's see what happens when
__dict__
and__weakref__
are not defined:And:
The historical reason behind it is: 373c741#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872R1356-R1377
What do others think: should we remove
(if defined)
part?If so, I have a PR ready.
Linked PRs
(if defined)
part from__dict__
and__weakref__
docstrings #112268(if defined)
part from__dict__
and__weakref__
docstrings (GH-112268) #112270(if defined)
part from__dict__
and__weakref__
docstrings (GH-112268) #112276The text was updated successfully, but these errors were encountered: