How do you add a custom method to a built-in python datatype? For example, I\'d like to implement one of the solutions from this question but be able to call it as follows:
You can't. And you don't need to.
See Extending builtin classes in python for an alternative solution. Subclassing is the way to go here.