Class hierarchy problem
Chris Angelico
rosuav at gmail.com
Tue Aug 6 05:30:39 EDT 2013
On Tue, Aug 6, 2013 at 10:10 AM, BrJohan <brjohan at gmail.com> wrote:
> Now, I want to create instances of the correct subclasstype as decided by
> the common baseclass, like this:
>
> i = Sup(args_allowing_the_baseclass_to_deduce_correct_subclass)
>
> where i can be of any class except Sup itself (as decided by Sup)
Can you do this as a factory function instead of the class itself?
Then all you need to do is call the appropriate class.
ChrisA
More information about the Python-list
mailing list