sub typing built in type with common attributes. Am I right?

Peter Otten __peter__ at
Fri Jul 18 11:16:54 CEST 2008

King wrote:

> I am new to python and getting into classes. Here I am trying to
> create subtype of built in types with some additional attributes and
> function. 'Attributes' is the main class and holds all the common
> attributes that requires by these subtypes. This is what I came out
> with. I need to know whether everything is right here ? or there are
> some  better ways to do it.

There may be some technical errors in your code, e. g. 

- the __slots__ look like a bit of bullshit: you already have a __dict__
  from the Attribute base class
- name mangling is done for attributes starting with two underscores

But the greater problem I see is that you are building up a huge bureaucracy
where pythonic code would concentrate on a concrete goal with minimal
administrative overhead.


More information about the Python-list mailing list