From glc at well.com Tue Jul 13 22:33:53 2004 From: glc at well.com (Greg Chapman) Date: Tue Jul 13 22:34:02 2004 Subject: [Python.NET] Enhancement request: extend __iter__ support to IEnumerator Message-ID: 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 "", 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 From bvb at iname.com Wed Jul 14 19:46:04 2004 From: bvb at iname.com (Bernard Vander Beken) Date: Wed Jul 14 19:46:06 2004 Subject: [Python.NET] OT: Boo, an interesting language for Python/.NET users Message-ID: <40F5715C.2000802@iname.com> 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 From pythonmailing at web.de Fri Jul 30 15:03:51 2004 From: pythonmailing at web.de (Marek Kubica) Date: Sat Jul 31 10:33:00 2004 Subject: [Python.NET] IronPython Alpha released Message-ID: <20040730150351.00003227@galileo> 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