Jan Christoph <con-f-...@gmx.net> added the comment:

I would argue to reopen this. Seeing I and other people run into that issue 
(e.g. https://stackoverflow.com/q/40883083/789308) quiet frequently.

Especially since it breaks the `global` keyword, e.g.:

__superprivate = "mahog"

class AClass(object):
    def __init__(self, value):
        global __superprivate
        __superprivate = value

    @staticmethod
    def get_sp():
        return __superprivate

if __name__ == "__main__":
    print(__superprivate)  # mahog
    try:
        print(AClass.get_sp()) 
    except NameError as e:
        print(e)           # NameError: name '_AClass__superprivate' is not 
defined'
    cl = AClass("bla")
    print(cl.get_sp())     # bla
    __superprivate = 1
    print(cl.get_sp())     # bla
    print(AClass.get_sp()) # bla

----------
nosy: +con-f-use

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27793>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to