[pypy-dev] fun with functions

holger krekel hpk at trillke.net
Sat Jun 26 13:04:39 CEST 2004


Hi Armin, 

[Armin Rigo Fri, Jun 25, 2004 at 05:18:18PM +0100]
> Moreover, we have a different compatibility problem too: in CPython, built-in
> functions don't have a __get__, so you can put them in classes and read them
> out without having the first argument bound to the instance.  For example, if
> you put 'operator.add' in the class TrivialObjSpace, then 'space.add' is
> exactly 'operator.add' and not a bound version of it.
> 
> What should we do about it?  Maybe asking python-dev for guidance?

We could ask who is relying on this behaviour that builtin functions don't
get bound on classes.  Or maybe just ask who even *knows* it let alone relies
on it :-) 

> Have 'unboundable function objects' -- like staticmethod, but the latter is not
> callable -- and make some carefully selected functions unboundable for
> compatibility?

only if need be.  Can you think of any real world use case? 

> For the 1st problem we could force a general solution by saying that the
> argument that a method binds is hidden to keywords.  It would also make the
> very first example of this e-mail work, although it doesn't work in CPython.

Your recent changes (of holding positional and keyword arguments in an
Argument instance (nice!)) already implement this.  Makes sense.  

cheers,
    
    holger



More information about the Pypy-dev mailing list