Posts tagged: PYTHON

Pocket Django

At the Western Mass. Developers Group meeting this week I showed a few people some of the unixy fun you can have with a (jailbroken) iPod touch and the Cydia package manager. Cydia is a port of Debian’s APT system to the iPhone platform – i.e. it’s a real package manager. It made it a snap to install Python, Mobile Terminal, Mobile Text Edit, Subversion, etc. This is the toolset that has allowed me to even do some work on the book as I mentioned in my last post.

Python one-liner of the day

This is a function that takes an integer and returns its ordinal representation, e.g. “1st” for 1 and so on. It’s not the most readable thing, but once I saw the pieces falling into place I couldn’t help myself. Repetition of the “th” literal is the only thing that bugs me. Oh well. ord_text = lambda n: "%d%s" % (n, "th" if 10 < n % 100 < 14 else {1:"st", 2:"nd", 3:"rd"}.

How not to advocate via Google Code

People sure are excited about the Google App Engine. Especially people who have some other favorite language besides Python. A significant number of the issue tracker items are of the form “Please add support for $MY_LANGUAGE”, where $MY_LANGUAGE might be VB.NET, C#, PHP, Java, Groovy, Ruby, Perl, etc. ad nauseam. I’m not going to comment on the language-wars aspect. But if you want your language supported (this goes for any issue in the tracker in fact), the thing to do is not to go to one of those issue pages and add a comment that consists of “+1”.

99 problems

There is a classic set of programming exercises called “Ninety-Nine Prolog Problems”. Though somewhat tailored to logic programming, they form an interesting set of exercises for other languages. I’ve seen adaptations of varying completeness for Haskell, Lisp, Perl 6, and Python. I was reminded of this all by a recent blog post by some bloke called Dave who was using the problems as a way to become more familiar with Python.

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.

Book news: Rough Cuts and Amazon

Just in time for Pycon, material from our new book is now available on the Safari “Rough Cuts” service. If you’re a Safari subscriber, or decide to become one to get access to our draft chapters, please check it out and let us know what you think! Reader comments are incredibly important to us. We have a title now – Python Web Development with Django – and we’re even listed on Amazon.

The Language I Will Kind of Learn in 2008: Smalltalk

In 2007, I took a whack at learning Haskell as my Language of the Year. It was an educational experience on more levels than I had expected. I didn’t get as far with the language as I might have hoped, but I did have the essential mind-opening experience of dealing with a purely functional, “lazy” language. My approach and style in my primary day-to-day language (Python) changed in a positive way.