Camen Design Forum

Python

append delete JJ

Has anyone tried using Python as a CGI for web development? I'm tempted to try it. It seems cleaner, more consistent, and less arbitrary than PHP. The downside is, it's less portable as PHP is a lot more popular at the moment. Also, the "whitespace parsing" it uses kind of deters me from using it. It seems like it would be incredibly annoying to figure out where a parse error is coming from when you misplaced a single whitespace.

All that aside, I'm still interested in it. Has anyone here tried it?

Reply RSS

Replies

append delete #1. theraje

Hey JJ, never used Python for CGI, but I have programmed apps with it. About all I can tell you is that if you get used to it, the indentations will come more naturally to you. I know when I made the transition from Visual Basic to Java programming, I had a hard time remembering to put semicolons after each statement. Eventually though, it became second nature.

Until that happens, though... yeah, if you're not bald now, you might be soon. :P

append delete #2. theraje

Sorry, the indentations came up because I was thinking of another programming language that uses indentation for scope interpretation. So many languages, so many oddities among them. :)

But I imagine whitespace being even more of a headache than indentation. Still, give it a try. If it's too much of a headache, try another language. I hear lots of good things about ROR (Ruby On Rails).

append delete #3. JJ

Thanks for the reply.

Hmm, what do you mean? I was under the impression that that's how Python encloses different statements. That's what I meant by "whitespace parsing" where the whitespace/indentation actually matters.

I've heard of Ruby on Rails, I was interested in it until I read this article and its comments: 456bereastreet.com/…

But yeah, right now I'm more interested in Python than RoR.

append delete #4. theraje

At first that's what I assumed you meant by "whitespace" (that it was indentation), but re-reading I thought you meant it included things like spaces (i.e. two spaces after an assignment operator, etc.).

It's been a good number of years since I've used Python, so I can't remember which it is. Another programming language that parses based on indentation is fresher in my mind, so that's what I went with initially. When I looked at your post again, that's when I realized that whitespace isn't always tabs.

append delete #5. Kroc

Pylons is basically the Python equivalent of Ruby on Rails. It's a framework for using Python as a web server: pylonshq.com

append delete #6. Anon #Pass: coward

I would say that Django djangoproject.com/… is closer to Rails; it's a more integrated stack.

append delete #7. Kroc

Is that username for real? O_o
Bonus points for originality.

append delete #8. JJ

lol

append delete #9. indieinvader

Python's "whitespace parsing" has to do with how it handles things that you'd need curly braces for in other programming languages. It's also really good at telling you where an error happened (if you forget a space you'll have a syntax error where the space is missing)

Also, Python is fun! I enjoy programming much, much, more now that my PHP days are behind me.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn