PEP 8: on member variables vs. attributes

Jonathan P. jbperez808 at yahoo.com
Fri Jan 17 03:41:46 EST 2003


>From PEP 8:

Designing for inheritance

      ...  In general, never make data
      variables public unless you're implementing essentially a
      record.  It's almost always preferrable to give a functional
      interface to your class instead (and some Python 2.2
      developments will make this much nicer)...

But don't properties and data variables (as attributes) look 
the same anyway?  So what's the diff between them, functionally
speaking?  Hasn't it been decided that get/set accessor
functions are a real hassle and that is why we see the concept
of a property replacing that of accessor methods (Delphi's
Object Pascal seems to have pioneered this) in newer
languages like C# and now also in Python via descriptors?
That would seem to contradict this particular point found in 
PEP 8.




More information about the Python-list mailing list