[Tutor] Dynamic inheritance?

Python python at venix.com
Sun Nov 20 01:46:46 CET 2005


On Sat, 2005-11-19 at 15:23 -0800, Danny Yoo wrote:

> Here's a small example that shows how classes can be treated just like any
> other value in Python:
> 
> #########################################
> def makeYa(superclass):
>     class Ya(superclass):
>         def sayHi(self):
>             superclass.sayHi(self)
>             print "ya"
>     return Ya
> 

Sorry I totally misunderstood.  

Essentially, you want the super class(es) in the class statement to be
variables.  It's a good thing Danny and Kent were around.

> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list