They test using inputs like 2 and 4 and everything works (we don’t have automated tests — we suck!). Of course it breaks for -1 now though. This is easy to diagnose when you’ve got a few lines of code but it causes a lot of grief when there’s hundreds…or, horror of horrors, if the ‘from math import *’ was done somewhere in the middle of the source file!

I’m sometimes accused of being obsessive and maybe I’m labouring the point a little but I see this stuff, in various guises, all the time!

Totally agree – it was one of those things that confused me at first when reading others’ code, and it didn’t make sense when writing my own code. I don’t mind code being a little longer if it’s more logical and readable. I thought it was just me …