Difficulty understanding attribute underscores... | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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 Respuesta
+ 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