Is there a way to specify a superclass at runtime?

Chris Colbert sccolbert at gmail.com
Mon Oct 5 09:49:42 EDT 2009


I dont think so, because that would require logic outside of the
controller class to determine which controller to instantiate.

My whole purpose for Controller is to encapsulate this logic.

So, if the data should be simulated, then i just need to pass
-simulate True as a command line argument, and the controller takes
care of it...

On Mon, Oct 5, 2009 at 3:44 PM, Richard Brodie <R.Brodie at rl.ac.uk> wrote:
>
> "Chris Colbert" <sccolbert at gmail.com> wrote in message
> news:mailman.868.1254748945.2807.python-list at python.org...
>
>> I am trying to abstract this machinery in a single class called
>> Controller which I want to inherit from either SimController or
>> RealController based on whether a module level flag SIMULATION is set
>> to True or False.
>
> At first sight, that seems kind of odd. Wouldn't it be simpler to have
> SimController and RealController inherit from Controller?
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list