[Python-Dev] Enum Eccentricities

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 24 00:07:45 CEST 2013


Steven D'Aprano wrote:
> It might not be a rule, but it's certainly the norm. I reckon that class 
> attributes that aren't accessible from the instance are significantly 
> more surprising than Color.red.blue.

There are really two different kinds of things that we
refer to as "class attributes". One is things that really
are attributes of the class itself, and the other is
things that are meant to serve as default or shared
instance attributes.

The confusion comes in because we use the same terminology
for both, and because Python doesn't provide any straightforward
way of creating user-defined class-only attributes, so
shared attributes tend to get abused for that purpose.
Then when someone comes along and creates a true
class-only attribute, people get all surprised and
complain about it. They shouldn't, IMO.

-- 
Greg


More information about the Python-Dev mailing list