Understanding Python from a PHP coder's perspective

Terry Reedy tjreedy at udel.edu
Mon Dec 7 16:53:48 EST 2015


On 12/7/2015 4:07 PM, villascape at gmail.com wrote:
> Hello all!  Just started getting into Python, and am very excited about the prospect.
>
> I am struggling on some general concepts.  My past experience with server-side code is mostly limited to PHP and websites.  I have some file called "whatever.php", the browser accesses it, and PHP parses it and returns HTML, JSON, etc.  Every now and then, I need to run some background PHP script, or have some PHP script initiated by a CRON job, or have some PHP script initiated by the command line running in an endless loop, and while it works, feel other languages might be more appropriate.
>
> So, my interest in Python...
>
> I've read up on Python, and while some aspects seem similar to PHP, some don't.  I have learned how to create Python script, have run it from the command line, and have even accessed it with Apache by placing http://example.com/myscript.py in the browser.  I am used to seeing .php extensions, but never .py extentions, and even visited multiple sites which I knew were written in Python, but never saw the browser expose the .py extensions.  I am obviously missing something.
>
> Why don't I see the .py extension in my browser?

Better security, I believe.

> Is Python event driven like PHP, or is it somehow different?

Python is not event-driven as you mean it, but you can do event-driven 
systems in Python.

> How should I view Python differently than PHP?

You should formulate your own general view.  For specific aspects, ask 
more specific quesitons, like you did above.

-- 
Terry Jan Reedy




More information about the Python-list mailing list