Special-purpose extension of Python -- new kinds of objects

Paul Rubin http
Sun Dec 28 19:40:57 EST 2003


Jeff Epler <jepler at unpythonic.net> writes:
> In your case, you could re-cast the "decision network" in terms of class
> definitions, and get pretty similar behavior if those classes have the
> right behavior in metaclasses:
>     class my_example(DN):
>         class X(Chance):
>             cpd = gaussian(mean=25, std_dev=75)
>         class Y(Chance):
>             cpd = gaussian(mean=12, std_dev=19)
>         Z = X + Y

When you say Z = X + Y, you've added two classes together.  Can you
actually do that with metaclasses?




More information about the Python-list mailing list