Palettable 3.0 Released

I’m happy to announce the release of Palettable version 3.0. Palettable is a Python library that packages a variety of color palettes for use with matplotlib or really anywhere. Here’s the full diff since the last release.

This release includes a number of new palettes:

The new cmocean, matplotlib, and MyCarta palettes are created from data that contains 256 color points per palette. By default palettes are created with lengths 3-20 colors, but you can request longer ones via the get_map function. For example, to get the matplotlib Viridis palette with 200 color points:

In [2]: palettable.matplotlib.get_map('Viridis_200')

You can find Palettable on the web at:

P.S.: Here’s a little demo notebook.

Ally Work

As folks become more aware of the social justice challenges we face as a country and in our communities they often wonder how they can help. There’s not one really great answer because we all have different experience levels, means, axes of privilege, and available free time, but there are some common-sense “getting started” points. People with privilege who help social just causes are often called allies (but more on this word below), and this post is about how allies can learn how to help. A very short and incomplete TL;DR:

  • don’t center your own ego and feelings at the expense of others’
  • examine and change your own behavior so you don’t perpetuate bad habits
  • whole-heartedly listen to people with less privilege than you
  • educate yourself on the history and literature of the movements you are interested in
  • step up when you can

The following are several resources for people looking for specific things to think about and act on. This list is focused on diversity-in-tech, and especially gender diversity, so pointers to other resources would be great.

(A note about the word “ally”: there’s a real failing of language here because we use this noun to refer to privileged supporters of social justice causes, but the causes don’t need nouns, they need actions. You can’t do 10 supportive things and then have the label “ally” for life. It’s a process of doing what you can, when you can. This essay gives a great breakdown of the distinction:

Note: This is based on a series of posts I’ve been putting together at work to educate coworkers on diversity and inclusion topics.

Dismissive Language

Dismissive language harks back to my post about microaggressions. It’s very easy to accidentally say something dismissive without realizing it. The most common examples of dismissive language I encounter are in descriptions of complex topics, often with the words “just” and “should”. For example, “All you need to do is just git rebase and everything should be fine” or “Just change this setting in your config and it should just work”. These constructions trivialize the listener’s problem and imply that they are stupid for not being able to figure it out on their own. (I’ve given technical examples here, but I imagine that this can happen in any context with complexity, like knitting or wet labs.)

I think it’s a good practice to try to completely remove the word “just” from your vocabulary, and watch your usage of the word “should” as well. At a fundamental level this is about putting yourself in someone else’s shoes, thinking about whether what you’re saying is appropriate given their level of experience, and making sure you’re not going to make them feel dumb by making something that’s actually hard/complex sound like you expect it to be obvious.

This is something we worry about a lot in Software Carpentry because we’re teaching complex computing topics to novice programmers. In fact, we recommend instructors completely avoid the word “just”. We discuss this a little in our instructor training materials:

Software Carpentry’s founder recently put together a short, 2.5 minute video giving examples of many of things you should not do when explaining complex topics to novices, such as using jargon and trivializing complexity. It’s worth a cringe-inducing watch:

The Recurse Center’s social rules also provide some great examples of things not to do:

Note: This is based on a series of posts I’ve been putting together at work to educate coworkers on diversity and inclusion topics.

Unconscious Bias

This post came across my Twitter feed this week that talks about some of the spurious, meaningless reasons software engineering candidates are rejected. It’s challenging to evaluate candidates and we have a lot of productive discussions about how best to do that, but there some personal characteristics that we know are irrelevant to job performance: gender, race, age, sexual orientation, marital status, parental status, accent, where you grew up, etc. But even though we know those characteristics are irrelevant, they can still unconsciously affect how we evaluate and work with people through something called unconscious bias.

Unconscious bias manifests in some scary and surprising ways. For example, elementary school teachers give girls lower scores on math tests, unless they don’t know the gender of the students.

Another study examined gender bias in academic science. From the abstract: “In a randomized double-blind study (n = 127), science faculty from research- intensive universities rated the application materials of a student—who was randomly assigned either a male or female name—for a laboratory manager position. Faculty participants rated the male applicant as significantly more competent and hireable than the (identical) female applicant. These participants also selected a higher starting salary and offered more career mentoring to the male applicant. The gender of the faculty participants did not affect responses, such that female and male faculty were equally likely to exhibit bias against the female student.”

Bias can even have far reaching, unintended affects. Early marketing of personal computers targeted almost exclusively boys and that probably had an affect on the number of women seeking computer science degrees today.

One of the ways to combat unconscious bias is to learn more about it, which you can do with these resources:

If you’re evaluating a job candidate take a minute to think about how biases might be affecting your judgement. In fact, this can be a valuable thing to do in any interactions you have.

Note: This is based on a series of posts I’ve been putting together at work to educate coworkers on diversity and inclusion topics.


Microaggressions are small, often unintentional actions that can make others feel out of place. Examples can include asking where someone is from, acting surprised when someone doesn’t know something, or always expecting women to do office-keeping work. They can make people feel like they don’t belong and distract them from doing their actual jobs. “Micro”-aggressions might not sound so bad, but over time and many interactions they create an unwelcoming environment that can cause employees to leave or cause people to not want to attend events. As an example, a friend of mine almost swore off of all tech events after she went to a social event where everyone ignored her and talked to her lawyer husband instead.

It’s everyone’s job to make sure they’re actively creating a environment in which everyone feels that they fully belong. You can help by learning more about microaggressions and doing your best to avoid committing them (they hurt even when you don’t mean them to).

Here are a couple of good links that describe what migroaggressions are and the affect they have:

This post does a great job explaining how microagressions affect your life:

The Recurse Center’s social rules are very useful for helping you avoid committing microaggressions:

Note: This is based on a series of posts I’ve been putting together at work to educate coworkers on diversity and inclusion topics.

Python 3 Universally


A Python user is starting a project and thinks to themselves, “Yay, new code! I can use Python 3 for this!”. They install the latest Anaconda for Py3 and get to work. A few days and hundreds of lines of code later they find out that a particular library they need (maybe imposm.parser) only supports Python 2. Our well intentioned user sighs, re-installs Anaconda for Py2, and carries on. Maybe next time (or maybe not). (This is a semi-autobiographical story.)

Elsewhere, a Python library maintainer is excited about Py3’s new asyncio module and could put it to immediate use but doesn’t want to alienate users who are stuck on Py2.

There are many valid reasons to be using Py2 today: a dated dependency, the inertia of existing code, not wanting to break a working setup, not knowing how/why to switch, and lack of time.

There are also many valid reasons for wanting to develop exclusively for Py3: access to new features, reduced support burden, simplified maintenance, wanting to get ahead of the 2020 end-of-support for Py2, and lack of time. These tensions have the potential to create much frustration in the Python community, but I think with some intentional effort on the part of Python developers and leaders it will all be fine. Read More »

C Extensions for Python 2 and 3

One of my upcoming tasks at work is converting Pandana to support both Python 2 and 3. The tricky bit is that Pandana has a C extension written in plain C using the Python 2 C-API, which is not compatible with Python 3.

It seems like the best way to have a C extension that supports both Python 2 and 3 is to not write the extension in C. These days there are a number of alternatives that allow you to write interfaces in Python or something like Python (Cython). I decided to make a sample project with some C functions to wrap so that I could try out CFFI, Cython, and the standard library ctypes module.

You can find the project with examples of all three and a longer writeup at Pull requests are welcome on the repo with further examples!