Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

“Getting” Python

David Brown: Python is a time bomb (in a good way):

Python is a time bomb. I’ve yet to see someone run with it the first time they are exposed to it. We all know the drill. “Indenting for block structure?” “Why should I use Python when I can do all that in Perl?” and the ever popular “Scripting languages are not for serious programs.”

But then, because you’re curious, you start using it. The first thing you notice is that (if you had good formatting habits to begin with) the indenting issue goes away. You were going to do it that way anyway, right? Then you notice that you got the job done in less time than you realized it would take. Personally, that’s my favorite bit. The “It’s done already? And it works?” feeling. I love it.

I’ve had that “It’s done already?” several times over the past few days. It’s actually quite disconcerting—you flesh out a code idea, run it... and it works. And it’s finished. And it’s generally in good enough shape to be used as-is. I think part of the reason is that I constantly have the interactive prompt open to try out code snippets, so most of the syntax errors and misunderstandings about how a language feature work have been dealt with before I even commit a line of code to my text editor.

This is “Getting” Python by Simon Willison, posted on 8th October 2003.

View blog reactions

Next: Firebird URL shortcut tips

Previous: Python snippet: ordinalth(n)

7 comments

  1. I think part of the reason is that I constantly have the interactive prompt open to try out code snippet..

    As a guy who went from some Python programming to a new job reworking an existing PHP app I can't get over how much I miss the interactive prompt.

    dusty - 8th October 2003 15:44 - #

  2. Imagine what it's like switch hitting with Python and C#...

    rick - 8th October 2003 20:11 - #

  3. C# in VS.Net has a poor man's interactive in the immediate window.
    But it's not as good as python's.

    Jeremy Dunck - 8th October 2003 23:26 - #

  4. If you like Python's interactive prompt, do a quick Google for "IPython." I've been using it a lot lately.

    David Brown - 9th October 2003 03:03 - #

  5. If you do C# and want a nice "interactive" environment for quickly checking out some code, see [TOOLS]Snippet Compiler.

    John Tobler - 9th October 2003 22:46 - #

  6. I use PyCrust for my interactive shell - comes with wxPython. Lots of 'tooltips' for class functions and the like makes it great to use. Plus a tree view of the namespace.

    Ben Thorp - 10th October 2003 12:48 - #

  7. I know it's not the same thing or nearly as useful, but you can run PHP code from the command line. php -r "code here" I think it is.

    Tim Fountain - 10th October 2003 20:28 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2003/10/08/gettingPython

A django site