So, I’m doing lots of exciting gathering of statistics and drawing of graphs at work at the moment, and have been making use of the excellent Matplotlib and NumPy Python libraries to help me. They’re both really handy bits of code, but there’s some awful examples of inconsistent design in there. For example:

import numpy data = numpy.array([1,2,3]) mean = data.mean() median = numpy.median(data)

– that is, mean() is a method on array(), which makes sense, but median() is a global function that takes an array as a parameter. I’m sure someone, somewhere, has a really good reason for that. But I’m also sure they’re pretty much wrong.

Tags: inconsistency, matplotlib, numpy, programming, python