pythonchallenge level5 and pickle

M

Michael Tan

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/peak.html)

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.yahoo.com
 
B

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?
 
M

Michael Neumann

Am Monday 27 June 2005 19:32 schrieb Belorion:
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
 
R

Robin Stocker

Michael said:
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/peak.html)

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
 
K

Kristof Bastiaensen

G

gga

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
 
C

Charles Hixson

Corey said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top