[Python-ideas] Add additional special method lookups to math module

Jeremy Sanders jeremy at jeremysanders.net
Wed Nov 9 22:10:19 CET 2011


Masklinn wrote:

> That makes no sense.

I think it does. I could write code relying on the math.XXX failing for 
types other than the built in numeric types, or for particular exceptions 
for particular calls. Also, if you override a standard module as a quick way 
to get existing code working, you can get lots of existing code paths which 
might fail in interesting ways, especially if there weren't unit tests for 
these cases. It would make more sense if the possibility was documented in 
the math documentation.

If you go and change the behaviour of built-in functions just by importing a 
module it could lead to some weird bugs. I know monkey patching can do this 
currently, but doing it by default seems dangerous to me.

Jeremy





More information about the Python-ideas mailing list