[IronPython] Writing new modules

Nick Bastin nbastin at opnet.com
Mon Aug 16 19:50:26 CEST 2004


On Aug 16, 2004, at 1:14 PM, Jim Hugunin wrote:

> Curt Hagenlocher wrote:
>
>> Nick Bastin <nbastin at opnet.com> writes:
>>
>>> There are a lot of extra names in each built-in module that don't
>>> exist in CPython, like 'Equals', 'GetHashCode', etc.  What are
>>> these, and where do they come from?
>>
>> These are members of the Object class that are supposed to be
>> overridden by derived classes.  It's a CLR thing.
>
> There's an interesting question whether or not these sorts of CLR 
> things
> should be exposed to Python programmers.  These particular methods will

FWIW, I think they should be exposed to Python programmers, but not by 
default, because it introduces a compatibility problem.  Really I would 
suggest something like:

from __DOTNET__ import Interfaces

This would of course fail on CPython, but at import time instead of 
runtime, and the developer would be making it clear that you needed to 
run in the CLR.  This could be implemented in the compiler (like 
__future__), or some sufficiently clever mixin on the built-in types, 
but I don't know if you can do that in C#.

--
Nick




More information about the Ironpython-users mailing list