php to python code converter

Pascal Chambon chambon.pascal at wanadoo.fr
Fri May 8 12:27:42 EDT 2009


D'Arcy J.M. Cain a écrit :
> On Fri, 08 May 2009 17:19:13 +0200
> Pascal Chambon <chambon.pascal at gmail.com> wrote:
>   
>> That's funny, I was precisely thinking about a php to python converter, 
>> some weeks ago.
>> Such a tool, allowing for example to convert some CMS like Drupal to 
>> python, would be a killer app, when we consider the amount of php code 
>> available.
>>     
>
> I'm not a big fan of PHP but I don't understand the desireability of
> such a tool.  If you have a good PHP app just run it.  The point of
> Python in my mind is that it is a cleaner syntax and promotes better
> code.  Anything that converts PHP to Python is going to leave you with
> some butt-ugly Python.  It also risks adding new bugs.
>
> If you want a Python version of Drupal then perhaps that is the project
> that you want to start.  Start fresh using the existing project as your
> requirements specification.  Don't automatically import all their
> coding choices that may be partially based on the language used.
>
>   
I agree that, in any way, the code resulting from this translation would 
be anything but pythonic :p

The point would rather be to consider code translated from php, ruby, 
perl or anything as extension modules, which have to be wrapped with 
pythonic interfaces (much like c/c++ libraries actually), or which are 
supposed to be deeply refactored.
It's always a pity when libraries available in a language have to be 
reproduced in another - even though building the translation tools would 
maybe ask for too much effort.

Concerning applications, like Drupal, it'd be different of course - I 
have no precise plan on how Drupal could be translated and then made 
"maintainable" in python, but for sure Python lacks a similar CMS, 
easier to approach than Plone and much more feature-full than others 
(Slemetonz, Pylucid...). And I don't feel quite ready for implementing 
such a thing myself ^^

Maybe the translation approach isn't the right one ; surely the best 
would be an interoperability at a lower level, like we have in Jpype, 
the DLR of .Net, Parrot, ironclad etc... but even with those projects, 
we're far from a fluent interoperability between languages, which would 
allow you to pick the best modules in the languages that fit the most 
for each of your tasks, on the platform you want  (I guess that's just a 
geeky dream).

Regards,
pascal


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090508/d78fa1c3/attachment-0001.html>


More information about the Python-list mailing list