Name Mangling of Python Private Variables

/ Published in: Python
Save to your folder(s)

Python: Private Variables

Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped.

Truncation may occur when the mangled name would be longer than 255 characters. When the class name consists of only underscores, no mangling occurs.

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.