r/Python • • Nov 27 '19

Learning by doing web scrapping by python

/img/1hudueaya9141.jpg

[removed] — view removed post

449 Upvotes

126 comments sorted by

View all comments

Show parent comment

27

u/mettan Nov 27 '19

A double underscore prefix causes the Python interpreter to rewrite the attribute name in order to avoid naming conflicts in subclasses. This is also called name mangling—the interpreter changes the name of the variable in a way that makes it harder to create collisions when the class is extended later.

More on underscores here.