python development practices?

James_Althoff at James_Althoff at
Wed Oct 31 19:57:45 CET 2001

I know I'm in the minority on this, but I greatly dislike the _iamspecial
naming convention.  To me, it's unnecessary and ugly clutter -- especially
when I see classes with 80% or 90% of the fields and methods named with a
leading  _.   In which case practically every line of code is slathered in
clutter.  Not to mention the fact that mangling-based hiding only happens
with a *double* (not single) leading underscore naming convention -- how
ugly does *that* make the code.  The rule in my projects, rather, is thus:
*all* instance variables are non-public -- following the "keep it simple"
principle.  If you are debugging things or are just exploring using the
interpreter then, by all means, have at them (and I think it is very useful
that you can do this in Python).  But if you are writing (non-ephemeral)
code outside of the defining class (or subclasses), then please use the
provided get/set methods.  If no such get/set methods exist there should be
no mystery about the intent of the fields.  Publicly-intended methods are
annotated with "Public" at the start of their doc strings.  Anything
without such annotation -- please use only for debugging or exploring
(again, outside of the defining class or subclasses).


More information about the Python-list mailing list