thecocce / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

class members with name self.__xxxxxxxx #379

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Considering the following script:

class test:
    def __init__(self, x):
        self.__x = x
        print self.__x

test(7)

setting a breakpoint on the line print self.__x, the debugger holds the name of 
this member as self._test__x

Original issue reported on code.google.com by mproel...@googlemail.com on 1 Aug 2010 at 1:02

GoogleCodeExporter commented 9 years ago
This is not a bug in PyScripter, but rather a feature of the Python language:

http://docs.python.org/reference/expressions.html#atom-identifiers

I suppose you could suggest that PyScripter should un-mangle them, but first 
make sure that you're using the right naming convention for the job here.  Per 
PEP 8 ( http://www.python.org/dev/peps/pep-0008/ ):

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

Original comment by stevenho...@gtempaccount.com on 6 Aug 2010 at 3:55

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 9 Aug 2010 at 2:12

GoogleCodeExporter commented 9 years ago
Thanks for the hint,

I didn't know that...

Original comment by mproel...@googlemail.com on 9 Aug 2010 at 1:47