Migrating from PHP to Python...

Joal Heagney s713221 at student.gu.edu.au
Sun Sep 2 20:45:32 EDT 2001


Rick Shin wrote:
> 
> Hi,
> 
> I'm a PHP man looking to migrate to Python for a change of scenery. I've
> skimmed over the specs, but missed a few PHP constructs that I find
> essential. Can anyone tell me the Python equivalents for:

> 3. variable variables  (or dynamic variables)

All variables in python are dynamic type. Is that what you were asking?

>>> a=1
>>> a
1
>>> a = 'hello'
>>> a
'hello'

> Finally, as someone who develops web apps exclusively, can anyone give me
> any compelling reasons why I should learn Python? From what I've read, PHP
> is faster, less resource intensive, and more prevalent (especially with web
> hosts). I've had, on the other hand, no formal training but recently read
> Code Complete, and wish to transcend the ranks of hackers. Python seems like
> an ideal language for instilling good, modular programming practices. Plus,
> it sounds cool. I like the idea of telling people "I program Python!".

A couple of things that may not sway you, but should perk your interest:

Clarity of code. It's acually possible for a beginner to download the
short tutorial from www.python.org, read a couple of the example
snippets that show up on this newsgroup, and learn the in's and out's of
python in a moderate length of time.

Python has a large library of functions/modules/classes (Using multiple
terminology for clarity of meaning - correct term is "modules", which
include functions and classes) - I don't know what the library for PHP
extensions is like, but the python library is comparable to c/c++
library in size/usefulness. The actual time-consuming thing with
learning python is learning about all these modules.

A couple of extensions to Apache, mod_python and mod_snake, to name a
few, that speed up python execution on the server.

A couple of non-Apache servers dedicated to serving python code. (Of
course, partially coded in python *grins*) Look up Zope to be really
intimidated *grins*. I've yet to get to that level, I'll probably stick
with Cheetah.

cgi, url, ftp, html modules included in standard release, as well as
some python agent modules that you can download.

Jython is a version of python implemented in Java. It allows you to
create Java applets/programs using the clearer syntax of python. (I
don't actually use Jython, but hear a lot of raves for it on this
group.)

There is a python wrapper for the c ming library, a opensource library
that allows you to programatically create Shockwave Flash format files.
(Of course, ming comes with an extension for PHP too, so I'm not so sure
that's a totally compelling argument.)

> Thanks for reading this,
> 
> Rick

-- 
      Joal Heagney is: _____           _____
   /\ _     __   __ _    |     | _  ___  |
  /__\|\  ||   ||__ |\  || |___|/_\|___] |
 /    \ \_||__ ||___| \_|! |   |   \   \ !



More information about the Python-list mailing list