Who Decides What
Counts as an Error?

Jon Reades & Ollie Ballinger - j.reades@ucl.ac.uk

5th November 2026

This Week’s Question

Who decides what counts as an error?

 

We’ll answer it with code and readings.

“Data do not need cleaning until there are strangers in the dataset.” ~ D’Ignazio and Klein (2020, 133)

Predict the Output

Pairs. No laptops. Vote with your fingers.

1. The Pizza That Changed

# the pizza class from the video, unchanged
p1 = pizza(sauce='white')
p1.add_topping('peppers')

p2 = pizza()
p2.base = "Plain old base"

pizza.base = 'Crusty'

p3 = pizza()

How many of p1, p2 and p3 now have a 'Crusty' base?

  1. 0
  2. 1
  3. 2
  4. 3

Answer: 3 (two of the three): p1 and p3. p2 set its own base, so the class change doesn’t reach it.

2. Where’s the Bug?

total = 0
print("About to start loop"
for i in range(1,10):
  total += i
print(total)

Which line is actually wrong?

  1. Line 1: total = 0
  2. Line 2: print("About to start loop"
  3. Line 3: for i in range(1,10):
  4. Line 5: print(total)

Answer: 2. The missing ) is on the line before the one Python complains about, in older versions.

3. Trapped

x,y = 10,0
try:
  print(x/y)
except ZeroDivisionError:
  print("You can't divide by zero!")
except:
  print("Something has gone very wrong.")
finally:
  print("Division is fun!")

What does this print?

  1. You can't divide by zero! then Division is fun!
  2. Something has gone very wrong. then Division is fun!
  3. A ZeroDivisionError traceback
  4. Only You can't divide by zero!

Answer: 1. The named except catches it, the generic one is skipped, and finally always runs.

4. Raising Hell

x,y = 10,0
try:
  print(x/y)
except ZeroDivisionError:
  print("You can't divide by zero!")
  raise Exception("Please don't do that again!")
finally:
  print("Division is fun!")
  1. Two messages, then the program ends normally
  2. Two messages, then a traceback that ends Exception: Please don't do that again!
  3. Only a traceback
  4. Division is fun! is never printed

Answer: 2. finally still runs, and the traceback shows both errors (“During handling of the above exception, another exception occurred”).

Who Decides What Counts as an Error?

Vote

According to the reading you did, the person who decides is…

 

  1. The analyst: that’s what expertise is for. Decide, and document it.
  2. The rules: decide in advance, in code, so anyone can check.
  3. The people the data describe: everyone else is a stranger in the dataset.

D’Ignazio & Klein (2020)

But what might be lost in the process of dominating and disciplining data? Whose perspectives might be lost in that process? And, conversely, whose perspectives might be additionally imposed? ~ D’Ignazio and Klein (2020, 131)

Likewise, data do not need cleaning until there are strangers in the dataset. ~ D’Ignazio and Klein (2020, 133)

Does one choose cleaner data at a larger scale that is relatively easy and quick to purchase? Or more accurate data at a local scale for which one has to engage and build trust with community groups? ~ D’Ignazio and Klein (2020, 135)

Etherington (2016)

The concepts of location, event, neighbourhood, field, object and network (Figure 1a) are a succinct list of spatial concepts used as the basis for six laboratory exercises […] ~ Etherington (2016, 118)

Unwin (1980) argued for open-ended laboratories, as highly structured laboratories do not teach research skills and result in students producing nearly identical work. ~ Etherington (2016, 123)

What Counts?

Where Do E-Bikes, Unicycles and Rickshaws Go?

Class hierarchy diagram grouping types of vehicle

Someone chose these categories. Who? And for what?

Split the Room

Choose your side. You are…

 

  1. Vehicle makers (left): you design, build and sell them.
  2. Safety advocates (centre): you count injuries.
  3. Local government (right): you license, tax and police them.

Alone, 1 minute: redraw the top two levels of the tree according to your interests. Where do the e-bike, unicycle and rickshaw go?

With neighbours, 3 minutes: agree one attribute that every Vehicle must have, and one value you would refuse (raise an error).

Same E-Bike, Three Trees

Ask pairs, one side at a time: What did you two decide? Where did the e-bike go, and what would you refuse?

class EBike(Vehicle):
    def __init__(self, motor_watts, assist_cutoff_kph):
        if motor_watts > 250 or assist_cutoff_kph > 25:
            raise ValueError("Not a legal e-bike")

For a maker, a 500 W motor is a product. For a regulator, it is an error. Same input, different answer.

What Happens to What Doesn’t Fit?

try:
  #... some code that might fail...
except <Named_Error_Type>:
  #... what do it if it fails for a specific reason...
except:
  #... what to do if it fails for any other reason...
finally:
  #... always do this, even if it fails...

But what might be lost in the process of dominating and disciplining data? ~ D’Ignazio and Klein (2020, 131)

Deliberate Mistakes

[…] including deliberate mistakes that need to be corrected […] ~ Etherington (2016, 123)

Listen for: in today’s practical, where does Python throw an error on purpose?

A Word About Groups

The sign-up form closed on Tuesday 3 November.

  • Jon is allocating everyone not yet in a group to a group with space.
  • Groups will be confirmed by Friday 6 November.
  • Why groups, and how they work: Group Working.

Intro to the practical

Here’s what we’re covering:

  • Trying to pull together everything you’ve learned over the preceding few weeks: functions, decorators, DoLs, list comprehensions, etc.
  • We’re going to work through creating several functions as well as a decorator to handle downloading and caching data from a remote URL in a way that saves on bandwidth costs by checking a local cache to see if a file exists before mindlessly requesting another copy from the URL.
  • We’re going to look at how writing comments — and they can be quite verbose when you’re starting out! — can help you to understand what’s going on.
  • And we’re going to place these functions into a library file so that they can be imported.

Optional second half

There is a second section that is about making use of classes and inheritance. This will help you a lot when you get to understanding how Pandas and Geopandas work and it’s the core power of Python, but do not panic if you run out of time to get to this. You will also pick it up through using Python. That’s not an excuse to not engage with the ideas, it’s an excuse for not spending nine hours on this practical.

You will see: - Custom exceptions - Abstract base classes - Inheritance - Class and instance variables - A tiny bit of polymorphism.

Over to Ollie

Listen For…

Damage detection in Gaza from satellite imagery

 

Listen for: how does Ollie check what the satellite shows? And who decides what counts as “damaged”?

Over to You

Before You Go…

Complete the sentence:

 

A view from a distance can / can’t be trusted when…, because…

 

A selection will open next week’s session.

Input

Provide your input here: form.menti.com/s/altu662n9tu3

Mentimeter QR Code

Mentimeter QR Code

Thank You

References

D’Ignazio, Catherine, and Lauren F. Klein. 2020. “Data Feminism.” In. MIT Press. https://data-feminism.mitpress.mit.edu/.
Etherington, Thomas R. 2016. “Teaching introductory GIS programming to geographers using an open source Python approach.” Journal of Geography in Higher Education 40 (1). Taylor & Francis:117–30. https://doi.org/10.1080/03098265.2015.1086981.