Just for interest really - community wiki - how much Python can we get Ruby to understand ? [ Probably be just as interesting to do the reverse as well].
The experiment (such as it is) perhaps to see how much can be written in Ruby-Cross-Python scripts that will result in identical outputs. The only 'cheat' I guess being allowed here is the too allow Ruby statements to precede the eventual 'common' script. [like the 'len' definition below].
For instance, this works in both:
a=[1,2,3]
mystring="hello"
bobby="hello"*3
epoch=1270123200
map={}
map['supamu']='egusu'
map['dedu']='paroto'
keys=map.keys()
values=map.values()
And doing this in Ruby:
class Object
def len(object)
object.size
end
end
class Object
def str(object)
object.to_s
end
end
Means this now works in both:
a=[1,2,3]
mystring="hello"
len(a)
len(mystring)
str(123)
I think the trouble will come with conditionals and loops, due to different syntax requirements. (the ':' at the end of Python lines for instance...)