[IronPython] Portable use of pickle.dumps()

2009-05-29 Thread Robert Smallshire
Hello, 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 course a unicode string.

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

2009-05-29 Thread Michael Foord
Robert Smallshire wrote: Hello, 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

Re: [IronPython] ironpython compared to powershell

2009-05-29 Thread Michael Foord
jocke khazad wrote: Hi everyone! I would like you ask this question that I seem not to get an answer for anywhere. What is the advantage of using ironpython compared to using only powershell? Or is it just a personal choice which one you like the best? Taste comes into it a lot. For example

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 Michael Foord
Robert Smallshire wrote: 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

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

2009-05-29 Thread Michael Foord
Robert Smallshire wrote: [snip...] Is this a theoretical problem at this stage or an actual problem? Its an actual problem with SQLiteParameter.Value from the SQLite ADO.NET provider. I think our original CPython code is a bit sloppy with respect to the distinction between text strings

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

2009-05-29 Thread Michael Foord
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

[IronPython] IronPython 2.6 CodePlex Source Update

2009-05-29 Thread merllab
This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/53173. ADDED SOURCES

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 Vernon Cole
I would humbly suggest that if you were to use adodbapi for your database access, the adapter would take care of all of this for you, and will also work in Python 3.0. Unfortunatly, the last remaining bug in adodbapi (caused by a bug in the IronPython COM interface) is in this exact area --

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

2009-05-29 Thread Vernon Cole
Follow up to my own comment... On Fri, May 29, 2009 at 11:38 AM, Vernon Cole vernondc...@gmail.com wrote: . You could use a similar construct based on whether IronPython or CPython were in use. I note that effort is now going forward to port pywin32 to IronPython. When that happens, my code

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

2009-05-29 Thread Michael Foord
Vernon Cole wrote: Follow up to my own comment... On Fri, May 29, 2009 at 11:38 AM, Vernon Cole vernondc...@gmail.com mailto:vernondc...@gmail.com wrote: . You could use a similar construct based on whether IronPython or CPython were in use. I note that effort is now going forward

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

2009-05-29 Thread Dino Viehland
Unfortunately there's probably going to continue to be a bunch of corner cases related to bytes/str/unicode until we move to 3.0. But hopefully we can come up w/ reasonable workarounds for most of them. In this case it seems like we should define __str__ on bytes and make it return a Unicode

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

2009-05-29 Thread Michael Foord
Dino Viehland wrote: Unfortunately there's probably going to continue to be a bunch of corner cases related to bytes/str/unicode until we move to 3.0. But hopefully we can come up w/ reasonable workarounds for most of them. In this case it seems like we should define __str__ on bytes and make

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

2009-05-29 Thread cur...@acm.org
On Fri, May 29, 2009 at 13:33, Michael Foord fuzzy...@voidspace.org.ukwrote: Dino Viehland wrote: Unfortunately there's probably going to continue to be a bunch of corner cases related to bytes/str/unicode until we move to 3.0. But hopefully we can come up w/ reasonable workarounds for most

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

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

2009-05-29 Thread Michael Foord
Robert Smallshire wrote: 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 =

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

2009-05-29 Thread Dino Viehland
Because in IronPython str is just an alias for Unicode. I think it would be extremely broken for us to alias all 3 to unicode especially when bytes clearly has a different meaning. -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On

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

2009-05-29 Thread Michael Foord
Dino Viehland wrote: Because in IronPython str is just an alias for Unicode. I think it would be extremely broken for us to alias all 3 to unicode especially when bytes clearly has a different meaning. Hmm... interesting. :-) Michael -Original Message- From:

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

2009-05-29 Thread Jeff Hardy
On Fri, May 29, 2009 at 12:05 PM, Vernon Cole vernondc...@gmail.com wrote: P.S.  Robert:  Thanks for documenting this. I am contemplating a new fork of adodbapi based on ADO.NET rather than COM (my target is Linux/mono so COM is out of the question.) I will very likely run into this problem

Re: [IronPython] ironpython compared to powershell

2009-05-29 Thread Jeff Hardy
I prefer to use powershell if I'm dealing with files, registry entries, AD, and (especially!) external programs - your classic shell scripting tasks, essentially. It's what it was designed for. Python, on the other hand, is a fantastic language for building and extending applications. - Jeff

[IronPython] how to work with delegates in IronPython

2009-05-29 Thread Vadim Khaskel
Hello everybody, Could somebody help to setup simple delegate in IronPython. I just need to generate event when list structure gets filled with data, and update GUI element. thanks a lot, V. _ Hotmail® has a new way to see

[IronPython] IronPython 2.6 and .NET 4.0 (and the GAC)

2009-05-29 Thread Jeff Hardy
Hi all, Are there plans to release versions of 2.6 for both .NET 2.0 .NET 4.0, or are the 4.0 previews just for demonstration? Also, (as nobody noticed my earlier mail :)), are there plans to support adding 2.6 to the GAC? When I asked for 2.0, it was mentioned that there are more stringent