Difficulty understanding attribute underscores... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difficulty understanding attribute underscores...

What does placing an underscore before an attribute indicate? I.e. _attributename = value

6th Jan 2017, 7:18 PM
Devin
1 Answer
+ 6
It's just a convention (meaning that Python interpreter will not pay any attention to it) indicating that the attribute is private and should not be accessed by the users of the class.
13th Jan 2017, 5:21 AM
Igor B
Igor B - avatar