[Tutor] Why should I use Python??

Daniel Ehrenberg littledanehren at yahoo.com
Mon Jan 12 15:36:43 EST 2004

Umesh C Joshi wrote:
> Hi,
> I am reading the mailing list from last one month. I
> found lot of
> subscribers are starter. I am doing internet
> programming from last 5 years.
> I have a good experience using PHP. Whenever I got a
> mail from this list a
> question arises in my mind. Do I need to learn
> python. Where It could be
> more profitable in my career.
> 1. is python a better language to use in web
> development than  PHP?

I'm not exactly sure what you mean by 'better'. For
simple but slightly dynamic websites, or if speed is a
big requirement, PHP might be better. But if you want
to make something that's complex, extendable, and
reusable, you're probably better off with Python.
That's mainly because Python doesn't rely on HTML
embedding and web development, making it much more
flexible, but slightly more difficult for simple
things. Although these are mostly opinions, Python
also has many advantages in its syntax and
functionality, such as:

-no curly brackets
-no variable prefixes
-better-integrated object orientation
-functional features including list comprehensions
-no need to put <? around programs ?> if they're not

If you just try Python, you'll probably see many more
advantages since I don't know much PHP.

For web development in Python, most people use Zope,
which has its own templating language called DTML.
DTML can be used similarly to HTML embedding in PHP,
but most of the coding is seperated out in DTML.

> 2. Apart form web programming, where do I use 
> python and HOW?
> I am really interested to explore python more.
> rgds
> Umesh C Joshi

Python can be used for anything. It is usually used
for standalone scripts, though. On Unix/Linux, simply
put the following at the beginning of a script to make
it run Python:
#!/usr/bin/env python
You do something similar on MacOSX, but all of the
path names are weird. On Windows, this will just be
interpreted as a comment. On all platforms with a GUI,
file associations can be used to make it so if you
double click on a Python script (ending in .py or
.pyw), it will automatically run it using Python.

Daniel Ehrenberg

Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

More information about the Tutor mailing list