Pixel Art in Yarn

Since its inception in 2011, NextThought has used the same star-shaped logo created by Whitney Martin Design. The logo has taken many forms and appeared in many places over the years: mugs, hats, stress balls, business cards, shirts, gym bags, this blog—the list goes on and on. But could it be re-created in yarn?

Spoiler alert: yes. Yes it could.

Read more…

Pre-release Version Pins are Sticky

The popular Python web framework Pyramid recently had a bug. Installing a released version of Pyramid, such as 1.8 or 1.9, somehow resulted in installing a pre-release version of one of its most important dependencies, WebOb. This was surprising and potentially disruptive in a production environment. Having been surprised by a similar bug in a different project, I followed this with interest.

Read more…

Python's Old Iteration Protocol

A few places in the Python language reference coyly refer to "the old-style iteration protocol." What is that protocol and how is it different from "the new-style iteration protocol?" Does it have anything to do with the difference between old-style and new-style classes? Let's dig in to see how iteration works now, and how it used to work.

Read more…

Editor Wars: Violent Delights Have Violent Ends

As developers, one of the most important tools in our toolkits is our editor. Looking around the office, you'll find a wide variety of editors in use, everything from editors with long pedigrees to the most recently developed editor boasting the technology du jour.

The choice of editor can be a very personal thing. While we have no interest in starting or escalating the actual editor war, we thought it would be interesting to survey the office and collect some stories about editors and the people who use them in this ongoing (sporadic) series.

Implementing gevent locks

Previously we talked about gevent's hub and how greenlets switch in and out of it to implement IO. This time, let's talk about how we can use those same primitives, plus the properties that make greenlets greenlets, to implement locks. We'll start by walking through some basics about locks and move on to how locks are used in Python when working with threads. All of that will be background for finally covering how gevent implements greenlet-based locks.

Read more…

gevent's hub

The hub is an important part of gevent, but aside from a few sentences in the high-level description of the event loop, and the API documentation, not a lot has been written about the hub, its purpose, or how it does what it does. This post aims to change that and answer questions like:

  • What is the hub?
  • How does the hub run the event loop?
  • How do greenlets do IO? That is, how do they let the event loop run, while letting other greenlets run, and then pick right back up where they blocked?

Read more…