Hi all, Builtin-in functions differ from Python function in that you can't bind the former as methods. We are discovering more and more of cases like that: class Stuff: defaultComparison = cmp where self.defaultComparison(x,y) is expected to work. Instead, in PyPy, cmp is then called with three arguments: self, x, y. The problem is the number of cases we keep finding all around. I think that Guido said it was an internal undefined detail, but clearly a lot of people depend on it, so we're stuck. Samuele came up with a nice proposal: the attribute loading code of LazyModule (i.e. our internal modules) is a natural place to turn our functions into some kind of built-in functions. It will turn exactly the function into built-in ones and leave alone, e.g., the methods of class complex -- which need to be boundable to their complex instance! The proposal is thus to wrap functions into a <type 'builtin_function'> which behaves mostly like the original one, but doesn't have a __get__(). A bientot, Armin
Hi Armin, On Tue, May 03, 2005 at 19:02 +0100, Armin Rigo wrote:
Builtin-in functions differ from Python function in that you can't bind the former as methods. ...
Samuele came up with a nice proposal: the attribute loading code of LazyModule (i.e. our internal modules) is a natural place to turn our functions into some kind of built-in functions. ...
Good idea!
The proposal is thus to wrap functions into a <type 'builtin_function'> which behaves mostly like the original one, but doesn't have a __get__().
And i see you already hacked this, nice. For all the others: PyPy is now passing more than 80% of the core python language tests now, see here: http://codespeak.net/~hpk/pypy-testresult/ cheers, holger
participants (2)
-
Armin Rigo
-
hpk@trillke.net