[Python-Dev] PEP 8 updates/clarifications

Raymond Hettinger raymond.hettinger at verizon.net
Mon Dec 12 03:19:01 CET 2005


> Do not use accessor methods, like ``obj.getFoo()`` and
> ``obj.setFoo(v)``, instead just expose a public attribute
(``obj.foo``).

This advice is, of course, not appropriate for all users (properties are
not typically in a Python beginner's skill set) or all use cases.  It is
closer to one person's view of the One-Right-Way(tm).  Opinions on
programming best practices vary widely, evolve over time, and may be
context dependent.



> > While, on some level, private variables seem attractive, I think
that
> > experience (for everyone I know) has shown them to be an attractive
> > nuisance.  I recommend discouraging them.
> 
> I really really hate double underscores

FWIW, I think we have no business dictating to others how they should
name their variables.  This is doubly true for a convention that has a
long history and built-in language support.

My preference is to leave PEP 8 for the minimum practices necessary for
one programmer to be able to read and maintain another programmer's
code.



Raymond



More information about the Python-Dev mailing list