Removing inheritance (decorator pattern ?)

Maric Michaud maric at aristote.info
Tue Jun 17 05:22:18 CEST 2008


Le Tuesday 17 June 2008 05:10:57 Maric Michaud, vous avez écrit :
> The class complextiy problem is actually solved by :
>
> inst_with_alg1 = MyClassUsingStrategies((algo1_strategy,),
> (algo1_strategy,)) inst_with_alg1_alg2 = MyClassUsingStrategies(
>                                                       (algo1_strategy,),
>                                                       (algo2_strategy,)
>                                   )
> inst_with_alg12 = MyClassUsingStrategies(
>                                              (algo1_strategy,
> algo2_strategy), (algo1_strategy, algo2_strategy) )
>
>
> etc...

Ah ! they should be instances here, this also permit extra configuration 
parameters to be passed in the Strategies constructors :

inst_with_alg12 = MyClassUsingStrategies(
                                     (algo1_strategy(), algo2_strategy()),
                                     (algo1_strategy(), algo2_strategy())
                            )


-- 
_____________

Maric Michaud



More information about the Python-list mailing list