|
|
|
|
|
by msm_
37 days ago
|
|
The second form has no built-in meaning, but is frequently used in the wild. Often in local variables to avoid shadowing builtin types (`id_ = get_id()`) and in various libraries. Out of the top of my head, ORMs also use it to mangle reserved names. edit: I googled a bit and PEP8 explicitly says "Thus class_ is better than clss". and "single_trailing_underscore_: used by convention to avoid conflicts with Python keyword, e.g..." The fourth form is the mangling used for __x names internally (__x field in class Foo is actually _Foo__x I don't know where GP saw sixth form, but considering all other forms are from real-world usage, someone probably uses it too. |
|