Python supports a lot of magic methods for implementing custom functionality in objects, such as __lt__, __getattr__, etc. There are even magic methods that affect the way certain built-in functions perform, such as __len__ and __instancecheck__. But are there magic methods for all the built-in functions in python?
For example, if I wanted to change the way the any function would perform on a certain class, could I specify an __any__ magic method in that class? If that isn't an option, is there any way that I could specifically affect the way any applies to that class? (I realize that if I wanted special functionality for the way any receives the items from the iterable I could define __iter__, but that's not what I am looking to do)
Note that my desire to implement custom functionality for any is just an example, I don't explicitly want to define custom functionality for any.
chr()for example, orid().chr, if you were making your own number type you wanted to be used wherever anintcan be used.__int__, which is much more appropriate for that purpose.