in reply to Re: Converting Python to Perl and back again
in thread Converting Python to Perl and back again
2. Python dictionaries take tuples (and not strings) as keys - this makes Perl hashes hard to use for that area, as you have to find a way to encode any tuple to a string and back (I think of URLencoding the tuples and a special marker for the different elements of the tuple)
Well, no. :)
The values of dictionary keys in Python can be any immutable object, including strings and tuples that contain no mutable elements (e.g. a tuple that contains a list as one of its elements could not be a key).
As yet another challenge to add to the list; sigils. $foo, @foo and %foo semantics can't be represented in Python.
Python has built-in support for iterators and generators; Perl does not. There's no reasonable conversion path for these semantics.
Python classes can inherit from built-in types. The complications of munging this into some funky tie-fu aren't worth the return on investment (especially when you consider that Python's built-ins are a lot different from Perl's built-ins).
The best way to convert Python to Perl and Perl to Python is to contribute to the development of Parrot because there are far too many issues to make it reasonable to truly "convert" one to the other.
It's like trying to "convert" a BMW M5 into a Ferrari 360 Modena. I'll let you decide which is which. :)
|
---|