[IronPython] Rich comparison usage by IronPython's heapq implementation

2011-03-14 Thread Robert Smallshire
Hello, I recently ran into some issues with IronPython's heapq implementation whereby code that functions correctly on CPython failed with IronPython 2.6. The issue is that the CPython implementation of heapq only calls __le__() and __eq__() on the heap elements whereas the IronPython

[IronPython] FW: Reflection.Emit from IronPython: What is theequivalent of typeof() in C# ?

2009-08-07 Thread Robert Smallshire
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Robert Smallshire Sent: Thursday, August 06, 2009 1:53 PM To: 'Michael Foord'; 'Discussion of IronPython' Subject: Re: [IronPython] Reflection.Emit from IronPython: What is the equivalent of typeof() in C# ? Hi Michael, I'm

Re: [IronPython] Reflection.Emit from IronPython: What is theequivalent of typeof() in C# ?

2009-08-07 Thread Robert Smallshire
message and doesn't work. Prompted by your first sentence I've also tried simply, generator.Emit(OpCodes.Newarr, System.String) but I'm still getting RuntimeType[] rather than String[] in the generated IL. Thanks, Rob Robert Smallshire wrote: Hello, I'm attempting to drive

Re: [IronPython] Reflection.Emit from IronPython: What is the equivalent of typeof() in C# ?

2009-08-07 Thread Robert Smallshire
by prematurely rejecting your answers before I'd got my act together. It seems there are many equivalents of C# typeof in IronPython. Thanks, Rob -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Robert Smallshire Sent

[IronPython] Reflection.Emit from IronPython: What is the equivalent of typeof() in C# ?

2009-08-06 Thread Robert Smallshire
()) generator.Emit(OpCodes.Newarr, System.String().GetType()) generator.Emit(OpCodes.Newarr, clr.GetClrType(System.String)) however, all of these result in RuntimeType[] rather than String[] in the generated CIL. How do I get typeof(System.String) from IronPython? Rob Robert Smallshire rob

Re: [IronPython] Reflection.Emit from IronPython: What is the equivalent of typeof() in C# ?

2009-08-06 Thread Robert Smallshire
clr.GetClrType('') ? (on an instance of a string) Michael Robert Smallshire wrote: Hello, I'm attempting to drive the Reflection.Emit API from IronPython. In C# typical Reflection.Emit use makes use typeof(...) facility in C#, to enable the determination of types without needing

[IronPython] Portable use of pickle.dumps()

2009-05-29 Thread Robert Smallshire
' in IronPython into a 'bytes' instance in IronPython that will be byte-compatible with what I'm getting from CPython? Many thanks, Rob Robert Smallshire from home on behalf of Roxar Software Solutions Currently in Norway (UTC +1 hours) ___ Users mailing

Re: [IronPython] Portable use of pickle.dumps()

2009-05-29 Thread Robert Smallshire
Hi Michael, I'm trying to get some commercial code for a simple object database we have written for Python 2.6 to work with IronPython 2.6. In Python 2.6 the return type of pickle.dumps() is str, which is of course a byte string. In IronPython 2.6 it is also str, which is of

Re: [IronPython] Portable use of pickle.dumps()

2009-05-29 Thread Robert Smallshire
Hi Michael, [snip] My opening paragraph may be ambiguously worded - by 'interoperability' I didn't mean the ability to run the same code unchanged on CPython and IronPython (I have to change the code anyway to use a different database adapter) - I meant interoperability between

[IronPython] Minor bug in conversion of str to bytes?

2009-05-29 Thread Robert Smallshire
Hello, Lets create a bytes instance from a str, and convert it back to a str. a = bytes(ord(c) for c in Hello World) a b'Hello World' str(a) b'Hello World' As you can see, the leading b and the quotes become part of the string, which is unexpected. I guess the conversion is using __repr__

Re: [IronPython] Portable use of pickle.dumps()

2009-05-29 Thread Robert Smallshire
Michael, Michael Foord wrote: [snip...] Here is an example of getting a byte array from a binary pickle in IronPython: import pickle class A(object): ... b = 'hello' ... c = (None, 'fish', 7.2, 7j) ... a = {1: 2} ... p = pickle.dumps(A(), protocol=2) p