And Now For Something Completely Different…

Just becuase I don’t have enough diverse (and conflicting) interests, I’m currently learning Python. So far I like what I see. My only gripe is that the version of Python 2.3 Apple shipped with Panther does not support command line editing. In other words, in interactive Python, you can’t use up-arrow to access a command history (you have no history, except cut-and-paste, which means hands off the keyboard/on to the mouse), or use left-arrow to edit the current line (delete ’em and weep). I’m pretty sure that this can be compiled into Python, I don’t understand why Apple didn’t.

Also of note, I’m learning Python via Learning Python (go figure), which I’m reading via Safari Bookshelf. Although I really like dead tree editions, and generally prefer reading hardcopy to electronic copy, I have to admit that it’s working out pretty well. It’s especially a good choice for this book, for two reasons. The second edition is due out next month… no sense spending the money for a hardcopy of the current edition. Also, I’m working through many of the exercises in the book, so I’m at the keyboard anyway. I originally signed up for Bookshelf as a way to keep reference books at hand and audition books to buy, but so far reading a whole book online is working well.

Both comments and pings are currently closed.

4 Responses to “And Now For Something Completely Different…”

  1. Xian Says:

    How to fix panther’s readline.<br/>

    Proper python shell editing support requires Readline, which, as near as I can figure has not been included in any of the OSX Python installs because of some obscure licensing issue. Thankfully the Panther fix is way easier than it was in any previous OSXs (which required recompiling Python from source). Simply drop the readline.so into the right directory.

    Bbum tells how and has the important URLs: http://www.pycs.net/bbum/2003/10/25.html#a518

    Once installed the python shell is a joy. I use it for everything from tracking card game scores, to writing quickie functions for the ultimate lazy calculator.

    As an aside: _ is a special interactive shell variable that always has the value of the result of the last calculation.

    Enjoy!

  2. Xian Says:

    Gah, friggen line breaks aren’t automatic.<br/>

    Again:

    Proper python shell editing support requires Readline, which, as near as I can figure has not been included in any of the OSX Python installs because of some obscure licensing issue. Thankfully the Panther fix is way easier than it was in any previous OSXs (which required recompiling Python from source). Simply drop the readline.so into the right directory.

    Bbum tells how and has the important URLs.

    Once installed the python shell is a joy. I use it for everything from tracking card game scores, to writing quickie functions for the ultimate lazy calculator.

    As an aside: _ is a special interactive shell variable that always has the value of the result of the last calculation.

    Enjoy!

  3. chornbe Says:

    Well, I’ve recently jumped onboard the Python wagon. So far, I’m having a ball. Like everything new, there’s a slight curve in learning the paradigm shift, but it’s amazing how self-intuitive you and the machine come while writing Python. I’d like to be one of some of the early adopters of the “yeah, perl is cool and all, but python’s better for PRODUCTIVITY” attitude. Thumbs up to the Python guys!!

    I’ve already started working out in my head how I can re-re-re-vamp some production code at work and use it for some upcoming work that I thought I had a solid design on… most notably data file translation plugins to a job framework I’ve got in place.

    Oh, and I’ve committed (myself) to switching web hosts and jumping in, cold turkey and both feet, to the *nix hosting thing. As long as the new host offers Python. I’m going to completely rewrite my site (Done in C# on .NET) in Python and templated HTML. I thought about porting as much of my C# base over to a host that offers mono, but decided to break away from compiled code on my website where possible.

    There’s a lot to be said for edit-save-run on a website.

    Oh, and I’ve looked around a bit and there seems to be some initial work being done on Markdown for Python. I’ve decided that’s going to be my first thing… I’m going attempt to do a “bug for bug” port of Markdown to Python with no external libraries. Wheeeeeeeeeeeeeee.

  4. Pasi Savolainen Says:

    ipython<br/>

    If you haven’t heard about it yet, I suggest trying out IPython -interactive python extension that really makes a difference. (I can’t tell if it’s OSX compatible).