[Numpy-discussion] Request for advice: project to get NumPy working in IronPython

David Cournapeau david@ar.media.kyoto-u.ac...
Sun Oct 28 21:58:38 CDT 2007


Travis E. Oliphant wrote:
>>> An IronPython compatible version of NumPy would be great.    Of course 
>>> it could be done by using C# to write NumPy, but I'm not sure that this 
>>> would really be any less work than creating a "glue" layer that allowed 
>>> most (or all) C-Python extensions to work with IronPython.
>>>     
> I'm curious about why all the discussion is about putting Python and its 
> extensions on top of C# and very little discussion about just using 
> C#-based tools as an extension from CPython.
>
> Python .NET is a great example of what I'm referring to.
>
> The C# language and the CLR does solve some problems, but it does not 
> solve all the problems related to scientific computing that it could.   
> In particular, I wish it's cross-platform visibility where higher.  Mono 
> is a great start, but there are a lot of C# libraries that just don't 
> get made to work on Linux or Mac OS X.
I think it is useful to separate C# and the CLR: you can do C# without 
the CLR (with mono at least), and you can do CLR without C#. What is C# 
? At the core, it is a language with a C-like syntax with automatic 
memory management, and a huge framework. C is still, by far, the best 
language for interoperability. None (and this includes C++) comes even 
close. For a library, C is the best language to use if you care about 
interoperability, so I don't see how it would be a bad choice.

So I don't see the point of C#, at least related to numpy.
>
> The task of moving scipy to sit on top of the CLR seems rather large 
> without some automatic tool to allow calling CPython extensions from the 
> CLR that works in a cross-platform way.
>
> I don't really see the benefit that the CLR offers (unless all the hype 
> is just so you can write code that runs in a browser --- in which case, 
> are you really going to run matrix inversion on the CLR in a browser?)
I don't think running in a browser is the only useful thing of the CRL; 
I can see why this would be useful for some, but at least, for me, this 
is not interesting (in my current, PhD student position at least :) ). 
In a windows centric world, running on the CLR means having access to 
the whole windows framework. C# is not really an interesting language, 
frankly, the only thing which really matters is that it does automatic 
memory management, and is endorsed by MS, meaning access to the windows 
ecosystem. This by itself is already so huge that any other things is a 
detail.

No, the important point is the following: once you have an 
implementation on the CLR, you can use it from any language. For a less 
hyped based discussion of this, you can read the B. Meyer article (B. 
Meyer is quite involved with his company in .net, but at least, this 
article focus on the technology):

http://archive.eiffel.com/doc/manuals/technology/bmarticles/sd/dotnet.html

As a concrete example, look at F#: if numpy can run on the CLR, you can 
use it from C#, IronPython and F#. F# is, basically, OCAML on the .NET. 
And as much as I don't have much interest into C#, I consider F# to be 
much more interesting (before considering python + numpy as my 
environment of choice for all my numeric-based projects, I considered 
OCAML).

http://www.ffconsultancy.com/products/fsharp_for_visualization/index.html

If numpy can be used from F#, this would be interesting. But is this at 
all possible ? For example, are the semantic compatible (indexing, 
etc...) ? I have no idea.

Implementation-wise, this is an interesting problem to solve.

cheers,

David


More information about the Numpy-discussion mailing list