Tuesday, January 10, 2006

Making the switch to Python:

At last year's Emerging Tech Conference I attended the OSAF presentation about Chandler where Andy Hertzfeld talked about using various programming languages:

Java was cool -- I could program twice as fast in Java as I could in C++. And now I can program twice as fast with Python as I can with Java.

(That quote is paraphrased; sorry if I butchered it, Andy) That was the Python tipping point for me. Too many cool people all had so many positive things to say about Python and being able to code several times faster than C++ really resonated with me.

Now 9 months later, I've finally written my first decent sized Python application. Its a tool that will make it easier for me to post photos to my MovableType photoblog. Not surprisingly this little application took only a few hours to write -- even with the GUI dialog that gets all the pertinent info about a photo, creating and uploading/thumbnails and posting the entry to my blog.

I've been frustrated with C++ for quite some time. It is butt-ugly. Its hacked. Template compilation takes forever and eats all of your RAM. When all we really had was C, C++ was a great tool. But now that we have choices, I can hardly believe we ever put up with a tool like C++.

Python is elegant and fun. Learning Python has presented the perfect learning curve for me -- if I don't know how to do something, just try it. And 9 times out of 10, it works -- Python is quite intuitive and the docs are great.

I'm even more pleased with wxPython, the wxWindows Python bindings. Writing GUI applications is a pain enough, much less having to do it over and over for different platforms. wxWindows is a really nice cross platform toolkit and combining it with Python is the killer development platform I've been looking for. The next major application will be to write a cross-platform music tagging application to replace the MusicBrainz Tagger. I'm stoked that I will have one codebase that will run on all three major platforms.

The only snag so far was finding a good way to make wxPython applications behave like real Mac OS X applications. I want to drag a photo out of iPhoto onto the application icon and have it launch my wxPython application. DropScript refuses to start the application. ScriptGUI and PythonLauncher are kludgey and won't allow me to drop a file ono the application icon. What is the best way to make a wxPython application behave like a Mac application? Please hit the talk-back link below if you have some tips for me.

I'm having a great time with Python. I haven't had this much fun since I discovered perl.

0 Comments:

Post a Comment

<< Home