Clarifying the float/int/complex special case

I consider the special casing on the numeric tower a mistake. Wanting to only accept floats has practical applications when dealing with things that will later get passed to libraries that only enable fast math (slightly, but acceptably inaccurate) when passed floats, and it’s something that’s been flat-out missing. It’s not even sufficient to have this typed by convention as float because this special case is so well-known and relied on by people, so people will pass in ints. While this is solvable with documentation or runtime checking and erroring, the former means that people now have to think about when a type hint means what it means in the type system or not, and the latter means extra overhead, which would definitely be inappropriate in the case not supported right now.

3 Likes