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

Simon Burton simonb at NOTTHISBIT.webone.com.au
Sun Dec 28 20:36:20 EST 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:

http://groups.google.com.au/groups?hl=en&lr=&ie=UTF-8&threadm=pan.2003.09.11.01.50.58.897682%40webone.com.au&rnum=1&prev=/groups%3Fq%3Dburton%2Bclass%2Bgroup:comp.lang.python.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.python.*%26selm%3Dpan.2003.09.11.01.50.58.897682%2540webone.com.au%26rnum%3D1

funkalitious.

Simon.





More information about the Python-list mailing list