Hi!
Probably you all know IronPython (been vapourware a long time)... now
you can find on IronPythons homepage, http://www.ironpython.com, an
alpha version of it (means version 0.6).
I've only tested it under Windows, with both .NET Framework 1.1 and Mono
1.0 and it seems to work. Well, untill no it is not as mature as
CPython, but I've got Windows.Forms running without errors.
greets,
Marek
Hello,
While not really being Python on .NET, the Boo language is interesting
for .NET and python users:
"Boo is a new object oriented statically typed programming language for
the Common Language Infrastructure with a python inspired syntax and a
special focus on language and compiler extensibility."
More info: http://boo.codehaus.org/
Best regards,
Bernard
In the current Python.Net, if you do something which results in an IEnumerator
reference, you cannot use it where Python expects an iterator. E.g.:
>>> from CLR.System.IO import Directory
>>> files = Directory.GetFiles(".")
>>> list(files.GetEnumerator())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: iteration over non-sequence
Obviously, in the above case it makes more sense to use files directly for
iteration, but a couple of times I've run into methods which return
IEnumerators, and it is annoying not to be able to iterate over them. It looks
like it would be fairly simple to change ClassBase.tp_iter to check if co.inst
can be cast to IEnumerator, and if so, use that enumerator to initialize the
iterator, e.g. (I haven't tried to compile this):
[CallConvCdecl()]
public static IntPtr tp_iter(IntPtr ob) {
CLRObject co = GetManagedObject(ob) as CLRObject;
if (co == null) {
Exceptions.SetError(Exceptions.TypeError, "invalid object");
return IntPtr.Zero;
}
IEnumerator enumerator;
IEnumerable e = co.inst as IEnumerable;
if (e != null)
enumerator = e.GetEnumerator();
else {
enumerator = co.inst as IEnumerator;
if (enumerator == null) {
Exceptions.SetError(Exceptions.TypeError,
"iteration over non-sequence"
);
return IntPtr.Zero;
}
}
Iterator iter = new Iterator(enumerator);
return iter.pyHandle;
}
---
Greg Chapman