Difficulty understanding attribute underscores... | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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 ответ
+ 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