mypy sum error

Recently, I’ve been exploring the type hints functionality in Python. The other day, I ran across what I think is a bug (already known) in mypy. Here is a minimal working example of the issue I came across: 1 2 3 4 from fractions import Fraction my_value = 1 + sum([Fraction(k + 1, 5 ** k) for k in range(5)]) print(f"The result is {my_value}.") This program runs as you would expect.

What size are national legislatures?

Introduction The other day, I came across something called the “cube root rule”, which is a proposed reform to the size of the U.S. House of Representative. Since 1913, the size of the U.S. House has remained constant at 435 seats (except for a few years when two seats were temporarily added to accommodate the addition of Alaska and Hawaii). Under the cube root rule, the size of the U.

On (not) voting at a polling place

Because of the potential for COVID-19 to disrupt elections this fall, mail voting is getting a lot of attention. It’s not a good idea to make people choose between their safety and exercising the franchise. I grew up in Oregon, and spent the first decade of my adult life there, but now I have spent more of my adult life living outside Oregon than within it. Since moving from Oregon, I have shed many of my Oregonian habits: I have become used to pumping my own gas.

Giving up Celsius

When I was in elementary school, I came across a series of books in the school library about the metric system. I don’t remember the title or the author, but I do remember reading each of them and falling in love with the measurement system used by almost every country in the world other than my own. The advantages of the metric system, especially ease of conversion between units, are well-known, and I won’t belabor them here.

Bugs in the iOS calendar app

Stand-up mathematician1 Matt Parker found some interesting bugs in the iOS calendar app: I encourage you to watch the video, but the short summary is that if you scroll back far enough (centuries) in the year view of the iOS Calendar app, the year labels and some months disappear. I reproduced this bug on my iPhone: My iPhone’s calendar app year view for 1582 is messed up.

Repository of files related to the NYT COVID-19 dataset

I’ve created a GitHub repository based on the New York Times’ COVID-19 database. The New York Times has been compiling COVID-19 data from various state health departments. They have published the data as a GitHub repository. There are two files of interest in their repository: us-states.csv and us-counties.csv. In these CSV files, each row represents the number of (confirmed) cases and deaths in a particular geographical area as of a particular date.

What I believe

I strongly believe: Diversity enriches a society. Immigrants enrich a society. Minnesota is a better state because of the refugees who have made it their home. The Somali community’s presence in Minnesota is worth celebrating. The ideologies that pose the greatest danger to America are white nationalism and toxic masculinity. Anyone who seeks political power by demonizing immigrants and minorities is not fit to hold office.

Book recommendation: Palaces for the people

In Palaces for the People: How Social Infrastructure Can Help Fight Inequality, Polarization, and the Decline of Civic Life, sociologist Eric Klinenberg discusses the role of social infrastructure in maintaining the health of a community and its people. Klinenberg argues that well-designed social infrastructure can help reduce crime, improve people’s lives, bring different people into contact with one-another, and even protect lives during natural disasters. He examines a variety of social infrastructures, including libraries, public housing courtyards, schools, barbershops, bookstores, and community gardens.