Re: [IronPython] Printing an object out as a string

2009-01-27 Thread Jeff Slutter
Curt Hagenlocher wrote: > If you're willing to live on the bleeding edge and build from the latest > sources, it turns out that Tomas just added this functionality to the > hosting interfaces yesterday. ObjectOperations.Format(obj) should return > a string that matches what the REPL would have prin

Re: [IronPython] Printing an object out as a string

2009-01-27 Thread Tomas Matousek
If you need to call it from C# app you can use engine.ObjectOperations.Format(obj) where "engine" could be created like this: ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); ObjectOperations::Format calls "repr". Tomas -Original Message- From: users-boun...@lists.ironp

Re: [IronPython] Printing an object out as a string

2009-01-27 Thread Curt Hagenlocher
If you're willing to live on the bleeding edge and build from the latest sources, it turns out that Tomas just added this functionality to the hosting interfaces yesterday. ObjectOperations.Format(obj) should return a string that matches what the REPL would have printed. On Tue, Jan 27, 2009 at 7:

Re: [IronPython] Printing an object out as a string

2009-01-27 Thread Jimmy Schementi
repr([0,1,2]) > -Original Message- > From: users-boun...@lists.ironpython.com [mailto:users- > boun...@lists.ironpython.com] On Behalf Of Jeff Slutter > Sent: Tuesday, January 27, 2009 7:53 PM > To: Discussion of IronPython > Subject: [IronPython] Printing an object out as a string > > Gi

[IronPython] Printing an object out as a string

2009-01-27 Thread Jeff Slutter
Given an object, how can I go about printing out that object as a string representing the object in Python syntax? I need something a little more powerful than just object.ToString() I need something like how the interactive console reports the result of the statement. For instance: a = [0,1,2]

Re: [IronPython] import issue

2009-01-27 Thread Tomas Matousek
BTW, I've submitted a change recently (it should be already available on CodePlex) that allows you to simplify the below code to: ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); ScriptScope scope = engine.CreateScope(); engine.Execute("import re", scope); or if you don't need to

Re: [IronPython] import issue

2009-01-27 Thread Curt Hagenlocher
The most likely explanation is that you're missing a reference to IronPython.Modules.dll. On Tue, Jan 27, 2009 at 11:14 AM, Janofsky, Steven < steven.janof...@webloyalty.com> wrote: > Does anyone know why the following gives 'No module named re' error: > > > > ScriptEngine engine = IronPython.Ho

[IronPython] import issue

2009-01-27 Thread Janofsky, Steven
Does anyone know why the following gives 'No module named re' error: ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); ScriptScope scope = engine.CreateScope(); ScriptSource src = engine.CreateScriptSourceFromString( "import re", Microsoft.Scripting.SourceCodeKind.Statements );

Re: [IronPython] slow import time

2009-01-27 Thread Dino Viehland
Precompilation (see the pyc.py sample) + ngen is the best story here right now. The time is mostly spent compiling IL to native code. We're also working on fixing that on our side (which hopefully will make it into 2.6, but it's available in the source drops today under the -X:AdaptiveCompilat

[IronPython] slow import time

2009-01-27 Thread Renaud Durand
Hi, I know it must be a recurrent question. But why IronPython startup time is so long ? I have a Winforms App that takes around 15s to start. The first import starts at about 10s, so importing modules takes about 5 seconds. I Know that the 10 first seconds seem to be incompressible... But is the

Re: [IronPython] IronPython 2.0 Errors...

2009-01-27 Thread António Piteira
That’s great, new possibilities are always welcome. Thanks guys I will give it a try and let you know later on. -- Howland-Rose, Kyle wrote: > Hi Antonio, > Have you tried http://pychecker.sourceforge.net/? > PyChec