KeyError in self._handlers: a journey deep into Tornado's internals

Date Tags python

If you've worked with tornado, you may have encountered a traceback of a somewhat bewildering error:

Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/tornado/ioloop.py", line 832, in start
fd_obj, handler_func = self._handlers[fd]
KeyError: 16

A few other people have been confused ...

more ...


Global logging with flask

As of December 2016, Flask has a built-in logger that it instantiates for you. Unfortunately, this misses the errors and other log messages in other libraries that may also be valuable.

It would be nice to have a single logger, one that captures BOTH library AND app logs. For those ...

more ...

The Dangers of Patching

If you've ever used Mock (or the built-in mock in python 3), you'll know how powerful of a tool it can be toward making unit testing on functions modifying state sane. Mocks in Python are effectively a probe that you can send into a deep, dark function:

import ...
more ...

Pycon 2014: Day 2 Recap

The second day of PyCon was just as amazing as the first. The day started with a couple keynote speakers:

Keynote: Jessica McKellar

Jessica McKellar gave a talking about the current state of the world for programming classes in U.S. grade schools, and the numbers weren't pretty. The ...

more ...



Python Internals

Date Tags python

The internals of Python are actually pretty straightforward, but it's still worth a dive. I recently gave a talk at Zillow about it, so I'd thought I'd share some points here as well.

Everything here prefixed with >>> can be typed into the python interpreter (activated by typing ...

more ...

DRY Principles through Python Decorators

Date Tags python

Python decorators are a powerful tool to remove redundancy. Along with modularizing functionality into appropriate bite-sized methods, it makes even the most complex workflows into concise functionality.

For example, let's look at the Django web framework, which handles requests by methods which receive a method object and return a ...

more ...

Move over bash: Python is my language for setup scripts now.

I know when people discuss using programming languages, there's two main schools of thought:

  • Use the same language for as much of your stack as possible
  • Use the language that's most appropriate for each part of the stack as much of possible.

Clearly, there's very strong advantages ...

more ...

About Yusuke Tsutsumi
Software Engineer at Zillow. I focus on tools and services for developer productivity, including build and testing.

My other interests include programming language design, game development, and learning languages (the non-programming ones).