E-Scribe News : a programmer’s blog

About Me

PBX My name is Paul Bissex, and e-scribe.com is my consulting business. I build web applications using as much open source software as possible. From September to June I teach web design and other important non-photographic professional skills to photographers. In the '90s I wrote technology commentary and reviews for magazines, newspapers, and web publications, including Wired, Salon.com, FamilyPC, the late lamented Web Review, and the Chicago Tribune. Feel free to email me.

Book Project

I'm co-authoring a book, "Python Web Development with Django", with Jeff Forcier and Wesley Chun. It will be published by Prentice Hall in July 2008, but is available for pre-ordering on Amazon now.

Colophon

This site is built on a fresh trunk checkout of Django, running on Python 2.5.1, served by Apache and mod_python. The database is SQLite. The operating system is FreeBSD, on a VPS hosted at Johncompanies.com. Comment-spam protection by Akismet. Vintage topo imagery from the Maptech archive.

Pile o'Tags

Stuff I Use

Akismet, del.icio.us, Django, dpaste.com, Emacs, FreeBSD, Freenode, jQuery, LaunchBar, MacPorts, Markdown, Mercurial, OS X, Postfix, Python, SQLite, Subversion, TextMate, Trac, Ubuntu Linux, wmii

A Django site.
(Finally!)

Copyright 2008
by Paul Bissex
and E-Scribe New Media

From PHP to Python

A former colleague from my days in print design (and a wonderfully loyal reader of my blog to boot) writes to ask whether he should learn Python. He's a smart guy with a deep background in typography, publishing, and the Mac. He is not a programmer by trade, but has taught himself enough PHP to build a custom CMS for his newspaper. He writes:

I've invested so much time in PHP, and am quite proficient now (not bad for it being more of an avocation), but I respect your opinion and for a long time have wondered about switching.

I think back to going cold turkey on Quark and moving to InDesign, which I've never regretted since Quark's software has sucked since version 5, a long time ago. But only now am I feeling even half as proficient as I was in Quark. Of course, there have been other time-saving plusses (not having to round-trip to Photoshop, etc.). Still, the design experience informs my apprehension about the PHP/Python question.

My gut response is: Of course you should learn Python! It's great!

But is it great for him? Is it great for someone who really just wants to keep a website up and running, making content updates and occasional feature tweaks? For someone who doesn't want to become a programmer? I mean, yes, designer Jeff Croft eventually was lured into writing Python code to support his Django blog habit, but that's an exceptional case, and he had some of the world's leading Django experts at his elbow as he was learning.

If it were just about the coding, though, I don't think it would be a tough call. It's really server and deployment issues that are the potential deal-breaker for someone who only wants web stuff to be a small part of their workday. As Ian Bicking and James Bennett and others have written about at length, the ubiquity of mod_php/Apache on shared hosting servers means that PHP deployment for script authors is a non-issue. Upload the file and it's deployed.

My aphorism on the subject: There are a lot of nice things about PHP, it's just that the language isn't one of them.

I think my friend's XPress/InDesign analogy (I am stubbornly nerdy about calling the product "XPress", not just "Quark", sorry!) is pretty apt. It takes a while to become productive with a new tool, even one that is objectively much better than the old one. I was a real whiz at Quark XPress myself way back when, working for Disney Publishing and Ziff-Davis. I know exactly what he is saying about missing those hard-won ninja skills even when enjoying the fruits of the nicer tool.

I have a longer piece in me (some day, once the book is wrapped) aimed at the nitty-gritty, language-level and application-level details a PHP developer might stumble over when moving to Django and Python. For now I'll just say that I don't remember missing much as I began moving away from PHP several years ago.  Every year, general-purpose web hosting offerings get more powerful (q.v. Slicehost) and Python deployment options become more robust (q.v. mod_wsgi). If you get hooked on the language, then you will have sufficient motivation to brave that deployment frontier. So my advice in the end is: yes, learn Python (and then Django, of course).

Thursday, March 13th, 2008
+ + + +
8 comments

Comment from Eater, later that day

I wish like hell I had embraced Python about ten years sooner than I did. It's one of those things I never had the time for -- but when I finally made the time, I cursed myself for wasting so much time ;)

More to the point, it sounds like Python (and of course, Django) will simplify your friend's life a great deal.

Comment from Ray Smith, later that day

My suggestion would be to look at Drupal (or Joomla depending on your preference). Drupal gives you a great framework, tools, community and professional services while still using his PHP skills.

Python is a great language and I think it should be used by more people for more tasks ... but as you say the whole deployment issue for the smaller scale web sites is just plain difficult.

And I agree, the PHP language just plain sucks and Python is beautiful ;)

Comment from azeem, later that day

Do we also need to learn Javascript, CSS, HTML and other thigjamalies if we decide for Python. Or just Python also will be good enough for software jobs.

Comment from Paul, later that day

If you're doing web stuff, then yes, you'll still need to learn those relevant front-end technologies. But you can learn Python without worrying about any of that stuff -- in fact, I think it's best to begin learning Python on its own. See the official Python tutorial, for example.

Comment from Jacob, 1 week later

I really agree with you. I actually blogged about the same topic a little bit ago. i tried learning PHP, its just a mess. It is easy to understand and linear, but it just doesn't pay off in the long run.

Best, J

Comment from Semi, 2 weeks later

I'm trying to learn PHP at this time and i also have heard a lot about python. Thanks for your post, it brought me some clarity in this issue.

Comment from Jason Calleiro, 8 weeks later

I think a lot more people would try out django and python if it would be easier to get up and running. It took me forever to get up and running following 4 different tutorials.

But now that i am rolling i can see why python people speak so proudly about their language of choice.

Comment from Paul, 8 weeks later

Hi Jason,

Unfortunately, that's a familiar story, at least when it comes to deployment. In my experience helping (many) people, the most common stumbling blocks for newcomers are 1) understanding how the Python import path works and 2) handling static files, since Django doesn't serve them.

We've tried to address these points of confusion in our book of course, but in the meanwhile one other good spot for help besides the official tutorial material is the #django IRC channel FAQ and the documentation it links to.

Glad you're up and running -- welcome!

Post a comment

Comments use Markdown syntax. Your comment will not appear until approved, which may take a few hours or more. Spammers will be torpedoed.


(Will not be shared)

(Optional)