Moving to Python from PHP - 3 questions

From: Michal Migurski (mike_at_teczno.com)
Date: 02/20/05

  • Next message: John Machin: "Re: exercise: partition a list by equivalence"
    To: python-list@python.org
    Date: Sun, 20 Feb 2005 12:26:40 -0800
    
    

    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


  • Next message: John Machin: "Re: exercise: partition a list by equivalence"

    Relevant Pages

    • Re: [PHP] Re: Re: Re: php-cli vs python
      ... anyway on the topic, ive never used python, but i run gentoo and portage is ... php does have some annoyances, but i find they can almost always be handled ... In order to make a long term decision about a language, ... Library support ...
      (php.general)
    • Re: Python as replacement for PHP?
      ... > Python is not even close to being suited for this task. ... PHP claims to be ... sites) fails to handle error conditions, and will run amok given a ... - PHP, "the web designer's ideal first language", started out life as ...
      (comp.lang.python)
    • Re: Python as replacement for PHP?
      ... > Python is not even close to being suited for this task. ... PHP claims to be ... sites) fails to handle error conditions, and will run amok given a ... - PHP, "the web designer's ideal first language", started out life as ...
      (comp.lang.php)
    • Re: Re: Re: php-cli vs python
      ... I know that both php and python have support ... Am I to understand from this statement that python has also ... In order to make a long term decision about a language, ...
      (php.general)
    • Python as replacement for PHP?
      ... HTML using PHP. ... I am advocating considering switching to Python for a number of ... HTTP requests) in one language. ... functions from a Python script? ...
      (comp.lang.php)