[Tutor] Classes + inheritance

Arne Mueller a.mueller@icrf.icnet.uk
Fri, 16 Apr 1999 16:41:08 +0100


geek+@cmu.edu wrote:
> 
> Then <a.mueller@icrf.icnet.uk> spoke up and said:
> > from blast import *
> [snip]
> > class Iteration(Iteration):
> 
> This is really the source of your problems.  This Iteration overwrites
> the one imported from blast.  Why don't you try doing something like:
> 
> import blast
> class Iteration(blast.Iteration):
	def __init__(self, f):
>         sys.stderr.write('My redefined class Iteration ...')
>         blast.Iteration.__init__(self, f)

that doen't work, either. The class Iteration is not used by the class
(Blast) which is defined in another module. Does a class always look for
another class it uses in the module where it's defined? That might be my
problem - I thought it looks for the class definition in the module/file
that on top of the 'execution' stack. 

I've to think about a new idea how to solve my problem. I do have to
provide the opportunity to extend/redefine classes or at least class
methods in module 'a' which are originally defined in module 'b' -
classes in module 'b' then use the redefined methods of module 'a' and
ignore the original definitoon in their own module. ??? ok, I'll think
about a simple solution, maybe it's the wrong point to start with object
orientation ...