[IronPython] Python console control for WPF

Kristof Wagemans kristof.wagemans at gmail.com
Fri Jun 30 18:28:28 CEST 2006


I was actually thinking of System.Decimal. I can now create one with
Decimal(5), but it would be more convenient if I could just add a single
character or so to the number. You probably wouldn't like extending the
Python language for this, I would guess.

 

  _____  

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Friday 30 June 2006 18:03
To: Discussion of IronPython
Subject: Re: [IronPython] Python console control for WPF

 

I think we can keep FilterStackFrame public and like you suggest make it
just take an Exception object.

 

I think we're going to make the switch from SetGlobal taking a SymbolId to
using a string, but until we do that you're right to use
SymbolTable.StringToId.

 

For double you should ensure there's a decimal point in the number, or you
could always do float(1) which will give you the floating point version -
although the decimal point is preferred (in C# you can do 1D for this).

 

For Decimal are you referring to System.Decimal or Python's decimal type in
the standard library?  I assume it's the Python one, and I don't believe
there's any special syntax for that.

 

 

 

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans
Sent: Friday, June 30, 2006 7:06 AM
To: 'Discussion of IronPython'
Subject: Re: [IronPython] Python console control for WPF

 

Thanks for the info about directly calling a Python method. This is
definitively going to be useful.

 

Maybe someone else has answers for my other questions about
FilterStackFrame, no overload with name for SetGlobal and format specifiers
for double and decimal?

 

  _____  

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde
Sent: Wednesday 28 June 2006 0:05
To: Discussion of IronPython
Subject: Re: [IronPython] Python console control for WPF

 

Hi Kristof,

 

You can call a Python method as such.

 

public delegate int IntIntDelegate(int arg);

engine.Execute("def IntIntMethod(a): return a * 100");

IntIntDelegate d = engine.Evaluate<IntIntDelegate>("IntIntMethod");

 

Console.WriteLine(d(2)); // This prints "200"

 

 

I have opened this bug
http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython
<http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemI
d=632> &WorkItemId=632  to track the issue with setdefaultencoding.

 

Shri

 

________ 

Do
<http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F
0-45DF-8B78-DC1B43134038>  you want to help develop Dynamic languages on
CLR?
(http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F
0-45DF-8B78-DC1B43134038)

  _____  

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans
Sent: Sunday, June 25, 2006 1:09 AM
To: users at lists.ironpython.com
Subject: [IronPython] Python console control for WPF

 

I've been experimenting with a Python console control for WPF. The
improvements made for IronPython beta 8 make this a lot easier thanks to
several new functions on the PythonEngine: ExecuteToConsole, FormatException
and ParseInteractiveInput.

 

One of the things I need to do to communicate with a C# application is to
change the default encoding to receive non-ascii characters. For this I
execute several commands after the PythonEngine instance is created.

    

    import sys

    sys.setdefaultencoding('utf_16_le')

    del(sys)

 

Setting the default encoding seems like a good candidate for the options you
can pass to the engine while creating a new instance. It would also be
easier if I could get at the options through a PythonEngine instance.

 

I hope you're not going to remove the FilterStackFrame delegate from the
FormatException method as the comment seems to indicate. I think it's very
useful to filter my own C# application from the stack trace. Maybe you could
add an overload with just the Exception and FilterStackFrame?

 

To set a variable in the PythonEngine you need to use SetGlobal with a
SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a
SymbolId? It used to be easier with just a string to specify the name.

 

A useful enhancement for the PythonEngine might be if there was a way to
directly call a Python function loaded in the engine and pass parameters to
it and get the return value. You could also support out parameters similar
to calling a method through reflection.

 

If you want to specify that a number is a long you can write 10L. Is there a
way to specify that a number is a double or a decimal?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060630/06cd903f/attachment.html>


More information about the Ironpython-users mailing list