Tag Archives: python 3

Alternatives to Single Function Classes

In Stop Writing Classes, a talk every Python engineer should watch, Jack Diederich tells us to avoid classes that have a single method, such as:

Jack suggests, rightly, that you can just define and call a function like this:

Sometimes, however, your function needs to accept a specific set of arguments. For example,… Read More »

Opterator, revisited

A few years ago, I wrote a simple decorator that introspects a main() method signature and docstring to generate an option parser. I never really used it, mostly because back then, I wasn’t too keen on third party dependencies. Nowadays with distribute being maintained, well-documented, and working (plus I know how to use it properly),… Read More »

Hacking on PyPy

In another great Pycon2012 keynote, David Beazely asked the question, “is PyPy easily hackable?” After a great talk, he answered with a decisive, “I still don’t know.” Having sprinted on Python I’d like to answer his question in a bit more detail. I love David’s presentation style. He has a novel method of using phrases… Read More »

Web Applications in Python 3

Everyone knows that there aren’t any decent web stacks in Python 3, right? Nobody seems interested in porting Django or Turbogears or Pylons or Plone or Zope to the new, improved much more fun to write language. Almost true. There are a few less popular frameworks for Python 3, including my own half-finished psyclone: http://archlinux.me/dusty/2010/01/17/python-3-web-framework/… Read More »

Image Manipulation in Python 3

Enough libraries have been ported to Python 3 to finally make it seriously possible to write real world code in this modern Python interpreter. Sure, we don’t have django or really any decent web framework yet (CherryPy runs, but it’s not a full web stack), and database support is limited (SQLAlchemy supports postgres and sqlite3),… Read More »

SimpleHTTPServer in Python 3

If you’ve been doing any testing of client code that uses urllib or httplib, you probably know about this command:

This starts a very simple server in the current working directory; it serves all files from that directory, and is, quite simply, the quickest way to get something set up if you want to… Read More »