[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

pythonchallenge level5 and pickle

Michael Tan

6/27/2005 5:27:00 PM

hi,what is Ruby's equivalent module of the Python
"Pickcle" module? I am trying to use Ruby for the
Pythonchhallenge and I am in level 5 now but looks
like there is no way to resolve it by Ruby because it
relies on the Python pickle module.(level 5 url:
http://www.pythonchallenge.com/pc/def...)

What is Python pickle : "
3.14 pickle -- Python object serialization

The pickle module implements a fundamental, but
powerful algorithm for serializing and de-serializing
a Python object structure. ``Pickling'' is the process
whereby a Python object hierarchy is converted into a
byte stream, and ``unpickling'' is the inverse
operation, whereby a byte stream is converted back
into an object hierarchy. Pickling (and unpickling) is
alternatively known as ``serialization'',
``marshalling,''3.2 or ``flattening'', however, to
avoid confusion, the terms used here are ``pickling''
and ``unpickling''. "
BTW, anyone at pythonchallenge via Ruby? let me know,
so we can validate/improve our Ruby version solutions.



____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports...


7 Answers

Belorion

6/27/2005 5:32:00 PM

0

> Pickling (and unpickling) is
> alternatively known as ``serialization'',
> ``marshalling,''3.2 or ``flattening'', however, to
> avoid confusion, the terms used here are ``pickling''
> and ``unpickling''. "

Would Marshal.dump & Marshal.load work?


Michael Neumann

6/27/2005 5:35:00 PM

0

Am Monday 27 June 2005 19:32 schrieb Belorion:
> > Pickling (and unpickling) is
> > alternatively known as ``serialization'',
> > ``marshalling,''3.2 or ``flattening'', however, to
> > avoid confusion, the terms used here are ``pickling''
> > and ``unpickling''. "
>
> Would Marshal.dump & Marshal.load work?

No, because Python uses a different format than Ruby.
But yes, Ruby's equivalence to Python's pickle module is module Marshal.

Regards,

Michael


Robin Stocker

6/27/2005 7:11:00 PM

0

Michael Tan wrote:
> hi,what is Ruby's equivalent module of the Python
> "Pickcle" module? I am trying to use Ruby for the
> Pythonchhallenge and I am in level 5 now but looks
> like there is no way to resolve it by Ruby because it
> relies on the Python pickle module.(level 5 url:
> http://www.pythonchallenge.com/pc/def...)

Hi,

What about using Python to load the Pickle data, serialise it to YAML
and then load it again in Ruby?
This doesn't work if there are objects involved that aren't dictionaries
(hashes) or lists (arrays) or other standard YAML types.

Robin


Corey

6/27/2005 7:28:00 PM

0

On Monday 27 June 2005 12:10 pm, Robin Stocker wrote:
> Michael Tan wrote:
> > hi,what is Ruby's equivalent module of the Python
> > "Pickcle" module?
>
> What about using Python to load the Pickle data, serialise it to YAML
> and then load it again in Ruby?
>

There's also the ruby/python extenstion:
http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/...


Kristof Bastiaensen

6/27/2005 7:32:00 PM

0

On Tue, 28 Jun 2005 02:26:30 +0900, Michael Tan wrote:

> hi,what is Ruby's equivalent module of the Python
> "Pickcle" module? I am trying to use Ruby for the
> Pythonchhallenge and I am in level 5 now but looks
> like there is no way to resolve it by Ruby because it
> relies on the Python pickle module.(level 5 url:
> http://www.pythonchallenge.com/pc/def...)
>
[snip...]

This is what I found by googling (when I tried the challenge):
http://d.hatena.ne.jp/teamik...

It worked fine!

Cheers,
KB


gga

6/27/2005 8:42:00 PM

0


Try this. Hopefully google will not screw with this:

banner.yaml:
---
-
-
- " "
- 95
-
-
- " "
- 14
-
- "#"
- 5
-
- " "
- 70
-
- "#"
- 5
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 15
-
- "#"
- 4
-
- " "
- 71
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 6
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 9
-
- "#"
- 3
-
- " "
- 7
-
- "#"
- 5
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 5
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 10
-
- "#"
- 3
-
- " "
- 7
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 3
-
- "#"
- 2
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 7
-
- " "
- 5
-
- "#"
- 2
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 7
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 7
-
- " "
- 5
-
- "#"
- 3
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 5
-
- "#"
- 3
-
- " "
- 2
-
- "#"
- 5
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 4
-
- "#"
- 5
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 5
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 5
-
- "#"
- 3
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 1
-
- "#"
- 3
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 1
-
- "#"
- 3
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 10
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 7
-
- "#"
- 3
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 1
-
-
- "#"
- 4
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 2
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 4
-
- " "
- 7
-
- "#"
- 3
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 1
-
-
- "#"
- 4
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 10
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 14
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 1
-
-
- "#"
- 4
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 4
-
- " "
- 12
-
- "#"
- 4
-
- " "
- 1
-
-
- "#"
- 4
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 4
-
- " "
- 12
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 1
-
- "#"
- 3
-
- " "
- 11
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 12
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 2
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 2
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 3
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 2
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 3
-
- "#"
- 11
-
- " "
- 3
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 2
-
- "#"
- 4
-
- " "
- 5
-
- "#"
- 4
-
- " "
- 4
-
- "#"
- 3
-
- " "
- 4
-
- "#"
- 2
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 1
-
-
- " "
- 6
-
- "#"
- 3
-
- " "
- 5
-
- "#"
- 6
-
- " "
- 4
-
- "#"
- 5
-
- " "
- 4
-
- "#"
- 2
-
- " "
- 4
-
- "#"
- 4
-
- " "
- 1
-
- "#"
- 6
-
- " "
- 4
-
- "#"
- 11
-
- " "
- 4
-
- "#"
- 5
-
- " "
- 6
-
- "#"
- 3
-
- " "
- 6
-
- "#"
- 6
-
-
- " "
- 95


banner.marshal:
[[[" id[
[" i["#i
[" iK["#i
[" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[
[" i["#i [" iL["#i [" i[[" i ["#i[" i ["#i ["
i["#i[" i["#i[" i ["#i
[" i["#i[" i ["#i
[" i["#i[" i["#i[" i ["#i [" i[ [" i["#i["
i["#i[" i ["#i [" i["#i [" i
["#i[" i["#i[" i ["#i [" i["#i [" i["#i ["
i["#i [" i
["#i[" i["#i[" i
["#i [" i[ [" i["#i[" i
["#i[" i["#i
[" i ["#i [" i["#i[" i["#i [" i ["#i
[" i ["#i [" i["#i
[" i ["#i [" i["#i[" i
["#i[" i["#i [" i[[" i["#i[" i["#i [" i
["#i [" i["#i[" i ["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i[" i ["#i [" i["#i [" i[["
i["#i[" i["#i [" i
["#i [" i["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i[" i ["#i[" i["#i [" i[["#i ["
i["#i [" i
["#i [" i
["#i[" i["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i [" i ["#i[" i["#i [" i[["#i ["
i["#i [" i
["#i [" i["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i[" i["#i [" i[["#i [" i["#i [" i
["#i [" i["#i[" i ["#i [" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i [" i["#i [" i[["#i [" i["#i [" i
["#i [" i["#i [" i
["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i [" i["#i [" i[[" i["#i["
i["#i [" i
["#i [" i["#i [" i
["#i[" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i[" i["#i [" i[ [" i["#i["
i ["#i[" i["#i [" i
["#i [" i["#i[" i ["#i [" i ["#i [" i
["#i [" i["#i [" i
["#i [" i["#i[" i ["#i[" i["#i [" i[["
i["#i[" i ["#i[" i["#i [" i
["#i [" i["#i[" i["#i [" i
["#i [" i["#i [" i
["#i [" i ["#i[" i ["#i[" i ["#i [" i[["
i ["#i[" i
["#i [" i ["#i
[" i ["#i[" i ["#i [" i["#i [" i ["#i[" i ["#i
[" i ["#i[" i ["#i [[" id

Charles Hixson

6/27/2005 9:09:00 PM

0

Corey wrote:
> On Monday 27 June 2005 12:10 pm, Robin Stocker wrote:
>
>> Michael Tan wrote:
>>
>>> hi,what is Ruby's equivalent module of the Python
>>> "Pickcle" module?
>>>
>> What about using Python to load the Pickle data, serialise it to YAML
>> and then load it again in Ruby?
>>
>>
>
> There's also the ruby/python extenstion:
> http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/...
>
>
>
I note the date on that program is 1999, so I doubt it would work
without modification with either a recent ruby OR a recent python...how
extensive the changes would be is, perhaps, questionable, but expect
there to be some. (Also, most ruby software wasn't exactly "polished"
in 1999. I think that if this worked well, we'd have heard a lot more
of it before now.)

All in all, I'd rather go with converting the python to pyrex, compiling
the pyrex, and then importing it as a C library. Lots of work, but I'd
feel more certain of results.