Newbye and packages

Toni post_to_usenet at
Mon Jun 11 17:07:25 CEST 2001


(I have searched for this in the FAQ and groups, but have found no clue)

Imagine I want to build a package hierarchy of the kind:


with associated classes:

class image_file:
   "Base class for image files hierarchy"

class gif_file(image_file):
class png_file(image_file):

each on an independent package/module, so that it is easy to add more
classes as needed

I have tried several approaches, but never got to do something like

import image_file.gif_file
a = image_file.gif_file("test.gif")
if (a.transparency()) ....

The reason for having the base image_file class is for coding default
values for uncommon things. For example, if I coded a bmp_file class, I
wouldn't code the transparency() method and let de base class answer

What would be the right approach? Ideas welcome



More information about the Python-list mailing list