Use expression instead of ugly conditionals in @singledispatch