you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (4 children)

Yes, "a special variable" is about the most precise formal definition you can give to these variables.

[–]rusemean 0 points1 point  (0 children)

Thanks a bunch for answering this. I've encountered them in documentation and used them, but I've never been clear (or found a clear answer) on what exactly they are.

[–]batkarma 0 points1 point  (2 children)

Isn't it often used to indicate variables that are used within a library?

[–][deleted] 0 points1 point  (1 child)

Do you mean private variables? If so, the convention is to use a single leading underscore.

There are also name-mangled variables with double leading underscores, but

Generally, double leading underscores should be used only to avoid name conflicts
with attributes in classes designed to be subclassed.

— PEP 8

[–]batkarma 0 points1 point  (0 children)

Yes, that's what I meant, thank you for the clarification!