Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Feature or enhancement
Let's say we have a regular class and we callhelp() on it:
>>>classA: ......>>>help(A)HelponclassAinmodule__main__:classA(builtins.object)|Datadescriptorsdefinedhere:||__dict__|dictionaryforinstancevariables (ifdefined)||__weakref__|listofweakreferencestotheobject (ifdefined)
This leaves a strange impression: what does it mean for__dict__?
dictionary for instance variables (if defined)
It is defined.
The same for regular__doc__:
>>>A.__dict__['__dict__'].__doc__'dictionary for instance variables (if defined)'
Let's see what happens when__dict__ and__weakref__ are not defined:
>>>classB:...__slots__= ()...>>>help(B)HelponclassBinmodule__main__:classB(builtins.object)
And:
>>>B.__dict__['__dict__']Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>B.__dict__['__dict__']~~~~~~~~~~^^^^^^^^^^^^KeyError:'__dict__'
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.