Moving to Python from PHP - 3 questions

Michal Migurski mike at teczno.com
Sun Feb 20 15:26:40 EST 2005


Hi everyone,

I've been planning to move to Python from PHP for some time now. I use 
PHP extensively for web scripting, with mod_php, Apache, and a DB (I 
would characterize my knowledge of PHP as advanced). Here are three 
stumbling blocks I've experienced, for which I couldn't seem to find 
any helpful information via Google:

1) Mod_python on OSX. I use a Mac as my primary development 
environment, so I need mod_python to get anything done. Compiling 
mod_python from source fails under OSX 10.3, and mod_python does not 
appear to be included in Fink. I've found plenty of other questions 
about this on other mailing lists, but so far no conclusive answers - 
is mod_python on OSX currently a dead-end?

2) Session management. Cookie-based sessions in PHP are pretty 
transparent, with a small library of basic functions that do 95% of 
what anyone may need to store session data in serialized files and 
associate them with cookies. I've seen python code that accomplishes 
this, but so far no pre-built server-side session management modules.

3) Structured request variables. PHP has a really handy feature where 
request variables with name like "foo[]", "foo[bar]", or 
"foo[bar][baz]" are automatically structured into nested associative 
arrays. I can see that the python cgi module will make a list of 
MiniFieldStorage objects when more than one variable with the same name 
is provided, but that's about the extent of it that I've seen.

2 & 3 are problems I can solve on my own, but they're so transparently 
automatic in PHP that it's a real pleasure to use them. I can probably 
implement my own fixes, but I'd rather not have to. Alternatively, are 
these just "PHP-isms" for which python has a more native, more 
appropriate response?

An "RTFM" answer with a URL for the M would be great. :)

Thank you,
-mike.

------------------------------------------------------
michal migurski- contact info, blog, and pgp key:
sf/ca            http://mike.teczno.com/contact.html




More information about the Python-list mailing list