Get Your Weekly Dose of Python
Welcome to issue 68 of Python Weekly. I wish you all a happy, healthy and prosperous 2013. This first issue of the new year is packed with lot of great content. Enjoy it!

From Our Sponsor

Professional Cloud Storage from JustCloud is Simple, Fast and Unlimited. Just Cloud will automatically backup the documents, photos, music and videos stored on your computer, to the cloud so you are never without files again. Try it, It's FREE.


Articles, Tutorials and Talks

Decorators and Functional Python
Decorators are one of Python's great features. In addition to their intrinsic usefulness in the language, they also help us to think in an interesting way -- a functional way. This post explains how decorators work from the ground up. 

Optimizations are one thing -- making a serious data collection program run 114,000 times faster is another thing entirely. Leaning on 30+ years of programming experience, David Schachter goes over all the optimizations he made to his (secret) company's data-collecting program to get such massive performance gains. In doing so, he might be able to teach you a thing or two about optimizing a python program.
 
This post shows you some cool tricks on how to manipulate strings in python.
 
This article shows you how to build a simple website, containing two static pages with a small amount of dynamic content. While Flask can be used for building complex, database-driven websites, starting with mostly static pages will be useful to introduce a workflow, which we can then generalize to make more complex pages in the future. Upon completion, you'll be able to use this sequence of steps to jumpstart your next Flask app.
 
I so often come across various kinds of boilerplate code regarding dictionaries in Python, that I decided to show some of it here and share the more concise way of performing the same operations. 
 
Writing A Transport Adapter
Writing a transport adapter for HTTP is very easy, especially as the in-built Requests ones have very clean and comprehensible code. Writing them for new protocols is harder. This is because Requests is laser-focused on HTTP, as it should be. It is definitely possible to implement some other protocols as Transport Adapters in Requests. 
 
This tutorial covers everything you need to do to configure a blank Ubuntu Linux 12.04 LTS 64-bit server to run a Django application properly.  if you want to use a different Linux distribution, most of this tutorial will still be correct. You will have to translate all of the apt-get statements and package names to your distribution of choice.
 
The Twitter streaming API for those without firehose access is still useful and interesting, you just need to get your feet wet. This post focuses on how to mine tweets from the Twitter streaming API using Python and Tweepy. Before we begin, you need to create a new application on Twitter and get your API keys and secrets ready to roll.
 
This post explains how to create a theme for Nikola(a Static Site and Blog Generator) from scratch. 
 
Whether you want to catalog your mined public tweets or offer suggestions to user's language preferences, Python can help detect a given language with a little bit of hackery around the Natural Language Toolkit (NLTK).
 
We've been using Haystack with a Lucene backed engine called ElasticSearch - you know, for search. Unlike the popular Solr search engine, ElasticSearch uses schema-free JSON instead of XML and runs as a binary without requiring an external Java server. For our needs it optimizes simplicity and power.
 
Python's += Is Weird
Here's a Python gotcha I've hit often enough to merit a blog post: x += 1 is weird in Python. It's compiled roughly like x = x + 1, with two surprising consequences. 

A follow up post to the above one. 
 
Threaded Commenting System In Django
 
 
 
 

Interesting Projects, Tools and Libraries

Pyzo is an interactive computing framework based on Python. It's mission is to provide a computing environment aimed at doing science and building professional applications, that is easy to obtain, easy to use, and free.
 
PyZen is a continuous test runner for paranoid developers. As long as the script is running, it will monitor for changes in your code and re-run your test suite when needed. There are frontends for multiple frameworks as well as several notification UIs.
 
A Simple way to share your IP[y]thon Notebook as Gists. You can share your own notebook, or browse others'
 
It is an event driven concurrent framework for python. With pulsar you can write asynchronous servers performing one or several activities in different threads and/or processes.
 
A set of utilities and a project template for running Django sites on Heroku. 
 
When spammers ruin your mail server's reputation ( DNSBL ), get out the musubi! 
 
ipy_table allows you to quickly and easily generate richly formatted data tables in IPython Notebooks. Both an interactive and a class-based workflow are supported. In interactive mode table formatting operations can be applied (and the results seen) in succession.

Pint is Python module/package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.
 

Upcoming Events and Webinars
This is a must-attend event for any developers looking for python opportunities in the Bay Area.  Want a chance to meet face to face with the next Google, Facebook, Dropbox, or Airbnb? Welcome to HackerX, the most exclusive recruiting event for developers. It's one of a kind opportunity to meet some of the world's most innovative and fastest growing companies. 
 
We are going to kick off our 2013 technical talks with a series of three talks delivered by the developers of 50 on Red. 
  • Flask vs. Django
  • Application Dispatching and Async Processing using Flask and RQ
  • Python and Why It Didn't Work for Us
Come work on Python projects, get programming help, help others, and hang out. Bring your own project or work on one of the suggested projects.
 
We typically have a main presentation or a series of lightning talks, followed by discussion and Q&A.  There is a diversity of domains and experience levels represented, so come with your questions and be prepared to talk about how you use Python!
 


Get Your Weekly Dose of Python