Re: [IronPython] Hosting IronPython 2.X in .NET app
Ken Manheimer a écrit : On 7/10/07, *M. David Peterson* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On 7/10/07, *Sylvain Hellegouarch* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Not to worry :) However the question stands, will Python support closures (or does it already via lambda expressions?) Depends on your interpretation of what a closure is. One interpretation is that w ith closures you can, for example, have a series of lambda expressions, evaluate up to a certain point, add a marker, store it, and then continue where you left off at a later date. just to clarify, it sounds like you may be mistaking terminology here. the elementary structures by which computations can be stored for later continuation are called just that - continuations. closures, on the other hand, are an organization of program state that can be associated with an object - typically to implement static scoping, as was done for python functions and methods around, someone said, python 2.1. i seem to recall that ruby manifests blocks as first class objects, and associates closures with them, as well. (continuations are interesting, but mostly in the abstract - they're not generally of interest for direct use by programmers. they're the mother of all control flow structures - all the others can be expressed and built using them, but they're very low-level - you would hardly ever want to program with them directly. stackless python uses (used?) them as a key means of building the other flow control structures without using the machine (c, in that case) stack, and they enable economies for massive parallelism that most of us don't need (and couldn't handle without major attention). generators provide the means to express much of what programmers practically want in this vein, and the recent refinements to enable use of generators as coroutines (pep 342 http://www.python.org/dev/peps/pep-0342/) covers most of the rest. how these structures map to parallelism are up to the language implementation. guido has been actively disinterested in incorporating continuations to the python definition, for various reasons, and i don't expect that to change.) i couldn't resist this clarification, and hope i haven't mistaken what you were saying (or, what i'm saying:-). -- Thanks Ken as well for this explanation. This is one of those confusing subject for me and you helped a lot here :) Side note, talking about stackless, Arnar Birgisson just released yesterday a stackless version of the CherryPy HTTP server: http://code.google.com/p/stacklessexamples/wiki/StacklessWSGI Interesting days that is :) - Sylvain ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Kamaelia and IronPython (was: Hosting IronPython 2.X in .NET app)
On 7/11/07, Michael Sparks [EMAIL PROTECTED] wrote: On Wednesday 11 July 2007 01:42, M. David Peterson wrote: P2P audio streaming A *very* simplistic P2P streaming core written in an evening (last friday evening specifically) using Kamaelia can be found here: (really needs buffering, detection of broken connections, multiple sources, but does work) http://kamaelia.svn.sourceforge.net/viewvc/kamaelia/trunk/Sketches/MPS/LUGRadio/SimpleSwarm.py?view=markup http://kamaelia.svn.sourceforge.net/viewvc/kamaelia/trunk/Sketches/MPS/LUGRadio/SimpleSwarmRadioSource.py?view=markup Oh, this is cool! It was written for my presentation at LUG Radio Live this past weekend in Wolverhampton (UK). Gives an idea of the compactness of code you can get if you allow concurrency to be naturally handled in the system by thinking of them as communicating components. It's a powerful analogy, for sure! Right inline with the Smalltalk way of thinking about programming, something I truly appreciate. Come to think of it, the combination of Vista Smalltalk/DLR[1] + IronPython + Kamaelia + Silverlight (once Silverlight gains support for sockets) == my mouth drooling with the combination of possibilities. :D Peter (Cc'd): Have you had a chance to look @ Kamaelia[2]? [1]: http://vistascript.net/ [2]: http://kamaelia.org/ The first file (220 lines) is a generic peer. The second file (170 lines) is a source peer - specifically it captures BBC Radio 1 off broadcast from DVB digital TV broadcasts and then restransmits it. (Its an example source - someone actually intent on using this would have to replace that source with a source they have a license to redistribute) Am playing with this now. In the mean time, one problem I ran into that requires the yet to be implemented nested yield statements in IP 2.0, IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. from Kamaelia.Chassis.Pipeline import Pipeline from Kamaelia.Protocol.HTTP.HTTPClient import * Traceback (most recent call last): File HTTPClient, line unknown, in Initialize SyntaxError: yield in more than one try blocks (/Users/mdavid/Projects/extf.googlecode.com/vendor/IPCE-r6/Lib/Kamaelia/Internet/TCPClient.py, line 222) Beyond the above issue, things seem to be playing nicely which is really great! I'll run through the provided sample now and let you know if I run into any issues. Thanks, Michael! -- /M:D M. David Peterson http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | http://dev.aol.com/blog/3155 ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Kamaelia and IronPython (was: Hosting IronPython 2.X in .NET app)
On 7/11/07, M. David Peterson [EMAIL PROTECTED] wrote: Am playing with this now. In the mean time, one problem I ran into that requires the yet to be implemented nested yield statements in IP 2.0, IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. from Kamaelia.Chassis.Pipeline import Pipeline from Kamaelia.Protocol.HTTP.HTTPClient import * Traceback (most recent call last): File HTTPClient, line unknown, in Initialize SyntaxError: yield in more than one try blocks (/Users/mdavid/Projects/extf.googlecode.com/vendor/IPCE-r6/Lib/Kamaelia/Internet/TCPClient.py, line 222) So I ran into the same issue, m-david-petersons-computer:~/Projects/extf.googlecode.com/vendor/IPCE-r6 mdavid$ mono ipy.exe SimpleSwarm.py Traceback (most recent call last): File SimpleSwarm, line unknown, in Initialize SyntaxError: yield in more than one try blocks (/Users/mdavid/Projects/extf.googlecode.com/vendor/IPCE-r6/Lib/Kamaelia/Internet/TCPClient.py, line 222) I also ran into an issue in which Sylvain so kindly helped me track down, from Kamaelia.File.UnixProcess import UnixProcess ... Pipeline( SubscribeTo(RADIO), UnixProcess(mplayer -), ).run() But this is a platform specific issue rather than an issue with IP directly. So at this stage, and for the time being, it looks like any type of TCP communications won't work. Hopefully that will change soon enough :D -- /M:D M. David Peterson http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | http://dev.aol.com/blog/3155 ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] IronPython Logo / Icon
Hi Guys, I had embedded IronPython 2.0 (DLR) in my WPF app. I have also created a WPF based console similar to the DLRConsole sample shipped with Silverlight 1.1 SDK. While I also creating a button to toggle the console window I wanted to put an IronPython (or DLR) image in button content. After searching the web I did not find any logo nighters for IP, nor for the DLR. The only thing that I came across is thishttp://www.microsoft.com/belux/msdn/images/ironpython_55x55.jpgimage from the asp.net site. It only looks iron-ish, but nothing python like in it :) So my point is why does someone create a logo for IronPython (or even we can host an open competition for this :) P.S. Something like the Silverlight logo will be cool :) Regards, Stefan Dobrev ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] IronPython Logo / Icon
good idea! On 7/11/07, Stefan Dobrev [EMAIL PROTECTED] wrote: Hi Guys, I had embedded IronPython 2.0 (DLR) in my WPF app. I have also created a WPF based console similar to the DLRConsole sample shipped with Silverlight 1.1 SDK. While I also creating a button to toggle the console window I wanted to put an IronPython (or DLR) image in button content. After searching the web I did not find any logo nighters for IP, nor for the DLR. The only thing that I came across is thishttp://www.microsoft.com/belux/msdn/images/ironpython_55x55.jpgimage from the asp.net site. It only looks iron-ish, but nothing python like in it :) So my point is why does someone create a logo for IronPython (or even we can host an open competition for this :) P.S. Something like the Silverlight logo will be cool :) Regards, Stefan Dobrev ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Xiao Guohui Department of Information Science Peking University Beijing, 100871 CHINA ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] TypeError: Microsoft.Scripting.DynamicType is not callable bug(?)
Hi, *Background:* We have a number of Python scripts that we use for updating and setting up the devices my company make. We do this through calls to a number of COM classes via win32com.client.Dispatch(). We are interested in being able to call these Python scripts from various .NET GUI applications written in C# so naturally I started looking into IronPython. My goal is to make our CPython code as executable in IronPython as humanly possible so since win32com is not available through IronPython I wrote a simple C# interop wrapper handling the interops for the specific COM classes we need to call when setting up our devices: namespace win32com { public class client { public static object Dispatch(string comName) { rip } } } The annoying thing is that this hack works like a charm except in one type of case. *Problem:* Some of our COM classes return Item collections that are indexable by both specific names (string indexing) and normal int indexes - example in CPython: result=win32com.client.Dispatch(COMClass)(ItemName) and/or result=win32com.client.Dispatch(COMClass)(0) This works like a charm in CPython (and the interop version of our C# code for that matter) but it does NOT work in IronPython. In IronPython 1.1 I get this error message TypeError: object is not callable In IronPython 2.0 alpha 3 I get this error message: TypeError: Microsoft.Scripting.DynamicType is not callable. I can access the properties of the object such as item count however I cannot index into the result object by calling result.get_Item(ItemName). It gives the following error message TypeError: multiple overloads of get_Item could match (String) get_Item(Object) get_Item(Object) nor can I index into the result object by calling result.get_Item(0) which gives a similar error except the problematic match is Int32. So apparently IronPython cannot identify the type of the index objects when more are present? *Question* ** Anyone have any comments that can help me here? Have I missed some subtle issues with COM interop? Is this a known bug and if so when do you think it will be fixed? (I know I can get around the problem by writing specific IronPython code + changing the handling of the COM class in my C# wrapper but I REALLY don't want to nor should I have to if the goal is to make IronPython as clean as possible port of CPython.) PS. Great initiative and great work otherwise in the port BR Martin Storm Møller ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] What happends with AddAssembly ?
PythonEngine had a method called AddAssembly in 2.0 A1, in 2.0 A2 doesnt exist. How can i import an assembly right now? Thnx. ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] IronPython Logo / Icon
I nominate a grey-colored snake in the shape of the Visual Studio infinity logo. J From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guohui Xiao Sent: Wednesday, July 11, 2007 3:37 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Logo / Icon good idea! On 7/11/07, Stefan Dobrev [EMAIL PROTECTED] wrote: Hi Guys, I had embedded IronPython 2.0 (DLR) in my WPF app. I have also created a WPF based console similar to the DLRConsole sample shipped with Silverlight 1.1 SDK. While I also creating a button to toggle the console window I wanted to put an IronPython (or DLR) image in button content. After searching the web I did not find any logo nighters for IP, nor for the DLR. The only thing that I came across is this http://www.microsoft.com/belux/msdn/images/ironpython_55x55.jpg image from the asp.net http://asp.net/ site. It only looks iron-ish, but nothing python like in it :) So my point is why does someone create a logo for IronPython (or even we can host an open competition for this :) P.S. Something like the Silverlight logo will be cool :) Regards, Stefan Dobrev ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Xiao Guohui Department of Information Science Peking University Beijing, 100871 CHINA ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] What happends with AddAssembly ?
You can call ClrModule.GetInstance().AddReference(). The tentative thought is that we'll share this between languages so that you only need to do it once and all languages pick it up. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luis Capra Sent: Wednesday, July 11, 2007 11:32 AM To: users@lists.ironpython.com Subject: [IronPython] What happends with AddAssembly ? PythonEngine had a method called AddAssembly in 2.0 A1, in 2.0 A2 doesnt exist. How can i import an assembly right now? Thnx. ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] What happends with AddAssembly ?
Oks. Thank you very much! Luis From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dino Viehland Sent: Wednesday, July 11, 2007 7:16 PM To: Discussion of IronPython Subject: Re: [IronPython] What happends with AddAssembly ? You can call ClrModule.GetInstance().AddReference(). The tentative thought is that we'll share this between languages so that you only need to do it once and all languages pick it up. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luis Capra Sent: Wednesday, July 11, 2007 11:32 AM To: users@lists.ironpython.com Subject: [IronPython] What happends with AddAssembly ? PythonEngine had a method called AddAssembly in 2.0 A1, in 2.0 A2 doesnt exist. How can i import an assembly right now? Thnx. ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] Getting attribute of new-style bound methods overriding built-in types
That was mouthful. This is for 1.1. (Running the following code on 2.0a2/Mono dies inside System.Reflection.Emit. Ugh.) class C(object): def __str__(self): return 'C' obj = C() getattr(obj.__str__, 'attribute', None) Result: TypeError: Cannot cast from source type to destination type. This is InvalidCastException. IronPython/Runtime/calls/Function.cs has this comment on line 906: public sealed partial class Method (snip) { //??? can I type this to Function private object func; Apparently you can't... The error is thrown when you cast func to PythonFunction, I think. -- Seo Sanghyeon ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] Zero-length regex split
This sucks. I'm not sure which sucks more: that such code exists, or that it breaks on IronPython in hard-to-find manner. import re print re.split(':*', 'a:b::c') Quick workaround is to replace the pattern ':*' with ':+'. This may not be always possible. -- Seo Sanghyeon ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com