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

Simon Burton simonb at NOTTHISBIT.webone.com.au
Mon Dec 29 02:36:20 CET 2003

On Sun, 28 Dec 2003 16:40:57 -0800, Paul Rubin wrote:

> 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?

Yeah, i did this with the comparison operators on classes:




More information about the Python-list mailing list