Learning Python and Pylons, Part 1
By kenglish
I don’t have anything insightful to blog about these days other than the fact that I’m learning Python and Pylons for my school project. I am using a package called BioPython. Instead of reading the standard Python tutorial, I went through the Python course in Bioinformatics . This tutorial walks biologists through the python language using biological examples. It then introduces the main packages in the BioPython library. It has some fun exercises to make it at hands-on experience.
The Biopython API documentation leaves a lot to be desired. I am probably spoiled by raiilsbrains where I can just enter a search string rather than clicking until I can find what I need.
I did bust out and purchase the Python Cookbook. The Programming Python book is a massive 1596. This is very impractical for the travelling programmer to carry. It would probably end up unread and collecting dust on my bookshelf the way my copy of the Cryptonomicon does.
I am surprised that python doesn’t have ruby/perl/php style string interpolation of variable.
In perl/php, I would do:
print "$first_name $last_name";
In ruby, I’d do:
puts "#{first_name} #{last_name}”
In Python, I must do:
print first_name + " " + last_name
but quite often I’m seeing examples like this:
print "%s %s" % (first_name, last_name)
Is that throw back to C or what? Didn’t they add string variable interpolation to languages to make the code more readable?



February 8th, 2009