Why Python won't work on .net

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Dec 9 16:08:42 CET 2003

martin at v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) wrote in
news:m3y8tnw6wh.fsf at mira.informatik.hu-berlin.de: 

>> The main problem is that functions are first class objects in Python,
>> but not in the CLS. The CLS uses delegates to refer to functions, and
>> a delegate encapsulates both an object and a pointer to a method.
> In addition, I think one problem is that in CLS, a class has a
> pre-determined set of data attributes, whereas in Python, instances
> grow new data attributes as they live.

I don't believe that is too much of a problem. Even in Python many of the 
data types have a fixed set of attributes. Even user defined classes, if 
they use __slots__, might not allow you to add attributes.

So, for .Net, some user defined classes might have a __dict__ attribute, 
but others don't. Attributes which are accessed through __dict__ won't be 
visible to non-Python code, but that shouldn't be a problem.

>> I have been playing around with a variant on the managed Python
>> compiler, and I think I have figured a way to implement Python which
>> might just get around this bottleneck. Unfortunately it requires a
>> lot of refactoring from the original model, and I'm only working on
>> it occasionally in my spare time. 
> Very interesting. Are you willing to share the intermediate results
> that you get? Publish early, publish often :-)
I'm more than willing to share, but so far its been a massive refactoring 
job so I was waiting until things settled down a bit before releasing 
anything. I expect the main speed gains to come when I get the new model 
for functions and methods working and eliminate as far as possible calls 
the reflection apis.

Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?

More information about the Python-list mailing list