design question, metaclasses?

Kay Schluehr kay.schluehr at gmx.net
Sun Apr 12 22:50:33 CEST 2009


On 11 Apr., 20:15, Darren Dale <dsdal... at gmail.com> wrote:

> I am working on a project that provides a high level interface to hdf5
> files by implementing a thin wrapper around h5py.
> I would like to
> generalize the project so the same API can be used with other formats,
> like netcdf or ascii files. The format specific code exists in File,
> Group and Dataset classes, which I could reimplement for each format.
> But there are other classes deriving from Group and Dataset which do
> not contain any format-specific code, and I would like to find a way
> to implement the functionality once and apply uniformly across
> supported formats.

Seems like you are doing it wrong. The classical OO approach is to add
more details / refining classes in subclasses instead of doing it the
other way round and derive the less specific classes from the more
specific ones.



More information about the Python-list mailing list