[Python-Dev] Built-in functions as methods

Guido van Rossum guido@python.org
Fri, 18 Apr 2003 15:28:02 -0400

> Hi guys.  Greg, you were asking about making built-in functions act like 
> methods.  This could break code, if it applies to all built-in 
> functions.  In more than one Python version, I have stuck a built-in type 
> or function into a class, under the assumption that it would behave as a 
> 'staticmethod' now does.  If all built-in functions start acting like 
> unbound methods, existing code will break.
> I'm not positive, but I think there's even code like this in the standard 
> library.
> I'm all for anything that makes Pyrex easier for Greg to maintain <wink>, 
> but perhaps there is a flag that could be used to request the behavior so 
> that existing code won't break?

Good point!  I suppose Greg could use something very similar to the
standard built-in object type but with a __get__ method, or he could
define a flag you have to set in the ml_flags before __get__ returns a
bound function.

--Guido van Rossum (home page: http://www.python.org/~guido/)