Design pattern question
uwe.schmitt at procoders.net
Wed Aug 21 11:51:06 CEST 2002
Karl Schmid <schmid at ice.mpg.de> 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:
def __init__(self, algorithmclass):
self.algorithmclass = algorithmclass
def run(self, data):
# do something with self.algorithmclass and data
# maybe self.algorithmclass.calculate(data) ...
now you can use
Dr. rer. nat. Uwe Schmitt Computer science is no more about Computers,
uwe.schmitt at procoders.net than astronomy is about telescopes. (Dijkstra)
More information about the Python-list