Single leading dash in member variable names?
Ian Kelly
ian.g.kelly at gmail.com
Tue Sep 11 17:32:29 EDT 2012
More information about the Python-list mailing list
Tue Sep 11 17:32:29 EDT 2012
- Previous message (by thread): Single leading dash in member variable names?
- Next message (by thread): Single leading dash in member variable names?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Sep 11, 2012 at 2:53 PM, <e.doxtator at gmail.com> wrote: > On Tuesday, September 11, 2012 2:06:45 PM UTC-5, Ian wrote: >> Single leading underscore is a convention indicating that the name >> should be considered private and not used externally. It's a softer >> version of the double leading underscore that means basically the same >> thing but has syntactic significance. > > Thank you! > > PEP 8 says this is bad form. What do you think? Where are you seeing that? It says: Use one leading underscore only for non-public methods and instance > variables. > > To avoid name clashes with subclasses, use two leading underscores to > invoke Python's name mangling rules. > > ... Generally, double leading underscores should be used only to avoid > name conflicts with attributes in classes designed to be subclassed. > So a single leading underscore is the preferred style for non-public methods and attributes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20120911/d6e25464/attachment.html>
- Previous message (by thread): Single leading dash in member variable names?
- Next message (by thread): Single leading dash in member variable names?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list