[pypy-dev] Re: fun with functions

Terry Reedy tjreedy at udel.edu
Sun Jun 27 07:11:32 CEST 2004


"holger krekel" <hpk at trillke.net> wrote in message
news:20040626110439.GM19360 at solar.trillke...
> 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 :-)

>From this user's viewpoint, the fact that CPython's built-in functions do
not quite act the same as functions defined in Python itself (and hence
need a separate type ) is a bit of a optimization glitch.  Breaking the
Python function model does occasionally bite people, leading to puzzled
queries on c.l.p (Why doesn't this work (with a builtin) when that did
(with a true func)?  ... Because builtins are not the same...).  So I see
the possibility of uniform behavior as an advantage.

You might look as what Jython does with its builtins (I have no idea).

Terry J. Reedy






More information about the Pypy-dev mailing list