RE: [IronPython] How to call IronPython Interpreter with C# code?

2005-07-21 Thread Jim Hugunin
This is a good example, but I think that using Execute to load the assembly by name is a dangerous approach. I'd strongly suggest loading your assemblies using the following API - this is likely to be a standard idiom for making the program's classes available to a script: engine.LoadAssembly(typ

RE: [IronPython] Making A Windows Form App

2005-07-06 Thread Jim Hugunin
We clearly need a better design than the current sys.LoadAssembly* methods. For one thing, we shouldn't really be adding these to the existing sys module but putting new methods like this in a new IronPython module. As you point out, we should also do a better job of making this as invisible t

RE: [IronPython] not support Mixin

2005-05-27 Thread Jim Hugunin
Chu Kevin wrote: > >>>class RoseLoveSomebodyElse: >def sayGoodBye(self): >print "Let's say goodbye tonight." > > >>>lover.__bases__+=(RoseLoveSomebodyElse,) > > >>>John_and_Rose.sayGoodBye() > a error occur > > IronPython.Objects.PythonAttributeError: 'lover' object has no > attribu

RE: [IronPython] Contains() doesn't work anymore for sys.modules?

2005-05-23 Thread Jim Hugunin
The underlying implementation of module dictionaries changed from IDictionary to IDictionary. If you're trying to use the CLS methods, you'd want ContainsKey. However, this might easily change again as it should be an internal decision. In fact, it's probably a bug in IronPython that these m

RE: [IronPython] getting at the global __dict__ from a module?

2005-05-22 Thread Jim Hugunin
The dictionary you get back from globals() is the __dict__ from the current module. __dict__ is a special field which holds the dictionary which holds all of the rest of the data on a module. Another good way to get this dictionary is for the module to import itself and then look up the __dict

RE: [IronPython] Implementing an interface

2005-05-22 Thread Jim Hugunin
Neil Hodgson wrote: >I have an interface defined in C# that I would like to implement in > IronPython 0.7.5. Similar code works in Jython. The interface looks Implementing an interface in Python is one of the best ways to interoperate with a strongly typed language. As you noted, this works v

RE: [IronPython] [0.7.5] exception on exit

2005-05-19 Thread Jim Hugunin
This saving of snippets.dll is only done for purposes of debugging the IronPython code generator. The right solution is for us to add an engine-debug switch and only dump this file when that's enabled. Unless you're planning to look at the IL in snippets.dll there's no reason for us to dump this

RE: [IronPython] Trouble building 0.7.5

2005-05-18 Thread Jim Hugunin
IronPython-0.7.5 requires .NET 2.0 beta 2 (or later). I'm sorry that we didn't catch this sooner and at the very least made this prominent in the release notes. We should also modify the config file so that a nice error will be produced if you try to run on an earlier version. I suspect your

RE: [IronPython] Double-Import Bug

2005-05-18 Thread Jim Hugunin
Bob Ippolito wrote: > > On May 17, 2005, at 10:42 PM, Curt Hagenlocher wrote: > > >> Is this bug known? > >> That is, if a module fails to import, a second attempt to import does > >> not throw an exception. I think this is because > >> Importer.LoadFromSource puts the module into sys.modules bef

RE: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Jim Hugunin
SyncRoot should be supported on lists. This wasn't done only due to laziness on my part. GetHashCode is less clear. The property of GetHashCode that you're missing is that it must be consistent with Equals. This is required by both Python and the CLI. It's not possible to implement Python's

RE: [IronPython] Array Access Problem

2005-05-11 Thread Jim Hugunin
Drew Moore wrote: > Jim Hugunin wrote: > > > >Because of the way that value types work, there's no difference between > >the results of > > apt[0].X = 0and apt[0] = Point(0, apt[0].Y) > > > >The big question is how important it is that both of th

RE: [IronPython] Road Map for IronPython

2005-05-11 Thread Jim Hugunin
There's no published road map, but that's a frequent request and we need to do something about that soon. The plan is for IronPython to be fully CLI compatible which means that it should run on the Common Language Infrastructure. I think that you're asking about compliance with the Common Langu

RE: [IronPython] 'out' parameters

2005-05-11 Thread Jim Hugunin
Martin's response is right, but I'm afraid that the best way to use these return values might not be obvious to everyone. Python's tuple packing and unpacking operations are often used for multiple return values in standard Python libraries and IronPython should feel the same way. Here's how thes

RE: [IronPython] Array Access Problem

2005-05-10 Thread Jim Hugunin
Timothy Fitz wrote: > On 5/10/05, Jim Hugunin <[EMAIL PROTECTED]> wrote: > > >>> apt[0].X = 0 > > If value types were immutable this would throw. The exception message > > might give people enough information to get started tracking down the > > issue

RE: [IronPython] Array Access Problem

2005-05-10 Thread Jim Hugunin
I think that value types are a real advantage of the Common Language Infrastructure (CLI) even though they make life more difficult for IronPython. They're an advantage because they're an essential concept for a number of data structures and people will use the notion of a value type whether or no

RE: [IronPython] lambda form

2005-05-09 Thread Jim Hugunin
Timothy Fitz wrote: > On 5/8/05, Luis M. Gonzalez <[EMAIL PROTECTED]> wrote: > > Regarding lambda, map and reduce, Guido Van Rossum has said several > times > > that these built-ins are amongst its "Python regrets". > > > > This is what he said in a recent interview: > > > > - If you could change s

RE: [IronPython] System.Exception: can't convert 66.6 to System.Int32

2005-05-07 Thread Jim Hugunin
PhiHo Hoang wrote: > Why 66.6 cannot be converted to System.Int32 ? 66.6 can be both explicitly converted to an int and compared to one. >>> int(66.6) 66 >>> 12 < 66.6 True >>> 66.6 < 12 False It's a good thing that 66.6 won't be implicitly converted to an int since that would lose precision.

RE: [IronPython] lambda form

2005-05-07 Thread Jim Hugunin
March Liu wrote: > lambda key word may remove from CPython 3.0. Maybe we can replace it > by the other way as List Comprehensions, funcation Factory... I like to encourage people who come from a functional background to use list comprehensions instead of lambda when possible. I'm not sure that la

RE: [IronPython] Array Access Problem

2005-05-05 Thread Jim Hugunin
This is a known problem, but we don't have a good fix to it in IronPython. Here's how to set just the X value of a Point in an array today: apt[0] = Point(0, apt[0].Y) OR p = apt[0] p.X = 42 apt[0] = p I suspect that you're not very excited by either of these options. The problem is that Po

[IronPython] config files vs. env vars and site.py

2005-05-04 Thread Jim Hugunin
Right now, IronPython-0.7.* isn't well designed for building Python applications to be deployed. It's primarily a tool for developer use. Part of fixing this is making configuration nicer; however, I'm not sure that config files will be the right final answer. Here's how I see people wanting

RE: [IronPython] Temp directory for IronPython?

2005-05-03 Thread Jim Hugunin
It's just a bug that these go in the current directory. The site.dll file should be placed in the same directory as site.py as it is the logical equivalent of site.pyc. I don't know how hard this will be to implement. The snippets.dll file has no reason to be written to disk. This is only don

RE: [IronPython] Developing a System.Web.Service.WebService

2005-05-03 Thread Jim Hugunin
Anthony Tarlano wrote: > I was wondering if anyone has successfully created a WebService in > IronPython and deployed it using ASP.NET? > > If not I will make it a point to post my results after accomplishing > the task.. ;-) I haven't done it, but I'd love to see your results. I think that you

RE: [IronPython] Re: IronPython 0.7.4 released

2005-05-03 Thread Jim Hugunin
Nick Jacobson wrote: > What are nstr and zip2? Two little hacks that I wrote a long time ago while playing around with different implementation and performance ideas. They don't belong in __builtins__ any more and will be removed. In case you're curious: nstr is an ascii string type that I was

RE: [IronPython] Executing a python source from C#

2005-04-29 Thread Jim Hugunin
That will generate a SyntaxError just as if you passed a partial block to exec. If you're interested in experimenting with embeddable consoles, you should take a look at the code for IronPythonConsole which also uses PythonEngine to do its loops. Ultimately, I think that IronPython should ship

RE: [IronPython] Executing a python source from C#

2005-04-29 Thread Jim Hugunin
Fabien Meghazi wrote: > How can I execute some python code that I have in a String() from a C# > .NET > program or an aspx application ? > I also would like to get back the stdout that the python code produced. You want to use IronPython.Hosting.PythonEngine. Here's a simple example program. We'

RE: [IronPython] Not GotDotNet...

2005-04-28 Thread Jim Hugunin
Luis M. Gonzalez wrote: > In my expererince, one out of three times I visit GotDotNet the site is > down. > I've been rying to submit a bug since yesterday, but this is what I see: > > "Operational Troubleshooting in Progress > The Gotdotnet team is aware of the current site operational issues and

RE: [IronPython] reload or workaround

2005-04-26 Thread Jim Hugunin
Michael Spencer wrote: > Since reload is not available yet, what is the best workaround for re- > compiling > changed source for imported modules? Execfile is a good option for many situations and was implemented to make sure we had at least a partial reload story. Until we get great IDE support,

RE: [IronPython] Overloading OnPaint etc.

2005-04-26 Thread Jim Hugunin
This is broken. Unfortunately, you should assume that in IronPython 0.7.3 you can't override any methods from a CLS super type so that it will be seen from the CLS side. FYI - It is possible in IronPython 0.7.3 to override a very small set of methods from a CLS super type in such a way that ot

RE: [IronPython] Questions for FAQ or User Guide

2005-04-26 Thread Jim Hugunin
I've been working on a blog entry that tries to cover this in great detail. Rather than go silent until I find time to complete that, I thought I should chime in a little here. When working with CLS libraries, IronPython tries first to ensure that nothing is impossible and second to make intera

RE: [IronPython] (MS/Beta2) System.Collections.Generic.List bug?

2005-04-19 Thread Jim Hugunin
Keith J. Farmer wrote: > [Incidentally, the ".NET" in the version info is hardcoded -- is there a > means to pick up the full name of the environment, rather than just the > version? This would allow more accurate reporting between MS and 3rd > party CLR implementations.] We're using System.Envir

RE: [IronPython] Generics support in IronPython

2005-04-06 Thread Jim Hugunin
cool From: [EMAIL PROTECTED] on behalf of Jim Hugunin Sent: Fri 4/1/2005 5:17 PM To: Martin Smith; users-ironpython.com@lists.ironpython.com Subject: RE: [IronPython] Generics support in IronPython Martin Smith wrote: > Will IronPython support generics? Here

RE: [IronPython] CPython access

2005-04-06 Thread Jim Hugunin
Timothy Fitz wrote: > Where there be any plans for allowing IronPython to work with an > instance of CPython directly? There are quite a few instances where > this would be extremely handy (SWIG-wrapped libraries such as > wxPython, or tightly optimized pieces that deal directly with > operating sy

RE: [IronPython] Converting an script to exe or dll

2005-04-06 Thread Jim Hugunin
Jeremy Jones wrote: > Scott Hatfield wrote: > > >That's great! > > > >Now can you have it run without a console? > > > How do you mean? I put a sleep(5) in there so that I could see the > output when I double clicked on __main__.exe from Windows Explorer, but > a console still popped up. I think

RE: [IronPython] IronPython + Npgsql

2005-04-06 Thread Jim Hugunin
Hector Miuler Malpica Gallegos wrote: > thanks, just the problem in indexing, in C# Resultado[1], in python I > have not been able, solution: > Resultado.GetValue(1) This should work as easily in IronPython as in C#. In general, if things are more awkward in IronPython than in C# you should firs

[IronPython] More discussion of the IronPython license

2005-04-04 Thread Jim Hugunin
I know that I've been very quiet with answering questions about the license used for IronPython. This is primarily because I'm not the right person to be addressing these questions. Jason Matusow, MS's director of shared source, has been blogging about this license over the past week and now has

RE: [IronPython] Generics support in IronPython

2005-04-01 Thread Jim Hugunin
Martin Smith wrote: > Will IronPython support generics? Here's the short answer to your question: >>> from System.Collections.Generic import * >>> l = List[str]() >>> l.Add('hi') >>> list(l) ['hi'] >>> l.Add(42) System.Exception: bad args to this method This works today and creates a List. All

[IronPython] Renaming IronPythonConsole

2005-03-31 Thread Jim Hugunin
Thanks for the feedback on names for IronPythonConsole. I notice that there were zero votes for keeping the name as is . The two names that had votes in favor of them were fepy and ironpy. There were a few more of you in favor of fepy than ironpy for that science geek charm; however, I didn't not