New to pdb and I am using p dir(a) to list all of the attributes of object a in my Django App. But I don't understand what the attributes such as '_class_', '_dict_'
etc mean.
Asked
Active
Viewed 69 times
-1

Shawn123
- 437
- 2
- 5
- 15
-
They are internally used methods. They are sometimes referred to as "dunder" methods, because they have a Double UNDERscore in front and behind them `__something__` – TehTris Jul 27 '15 at 19:55
-
Did you try searching for them? – jonrsharpe Jul 27 '15 at 20:09
1 Answers
0
These attributes have nothing to do with pdb, actually. They are built-in attributes of Python objects. For example, the __dict__
attribute is a dictionary of all the attributes the instance of a class has. You can find a more detailed explanation here. As for __class__
, this is a reference to the class the instance has been spawned from. Again, a more detailed explanation can be found here.