Design pattern question

Uwe Schmitt uwe.schmitt at
Wed Aug 21 11:51:06 CEST 2002

Karl Schmid <schmid at> wrote:

> Now I would like to instantiate the abstract class, but to obtain an 
> instance of either the Cap3Assembler or PhrapAssembler class depending on 
> the assembler_type variable.

>>>> assembler = SequenceAssembler(assembler_type)

> Is this possible? 

you cold use someething like a plugin, but then the interface and
implementation is not really seperated:

    class GeneralAssembler:

	  def __init__(self, algorithmclass):
	      self.algorithmclass = algorithmclass
	  def run(self, data):
	      # do something with self.algorithmclass and data
	      # maybe self.algorithmclass.calculate(data) ...

    class Algorithm1:

	  def calculate(data):

    class Algorithm2:

	  def calculate(data):

now you can use 


o.k. ?

Greetings, Uwe

Dr. rer. nat. Uwe Schmitt      Computer science is no more about Computers,
uwe.schmitt at      than astronomy is about telescopes. (Dijkstra)           

More information about the Python-list mailing list