I also tend to agree with you on this. I think the more Pythonic way would be yo use a dict to map the type to the squaring function/lambda. This is probably a wraper around this, but it is not explicit and is yet another library dependency to maintain.
Community as #1. Mirrors my own thoughts ?