[Python-ideas] Fix that broken callable builtin

Ethan Furman ethan at stoneleaf.us
Sun Apr 19 17:51:51 CEST 2015


On 04/19, Ionel Cristian Mărieș wrote:
> On Sun, Apr 19, 2015 at 1:14 PM, Paul Moore <p.f.moore at gmail.com> wrote:
 
>> so the fact that callable() doesn't run arbitrary code is relevant to me.
> 
>_PyObject_HasAttrId(x, &PyId___call__) wouldn't actually do the call.
> What did you meant to say?

The __get__ method of the descriptor, whether of 'property' or something
home-grown, is the "arbitrary code", and could conceivably be quite
complex and/or slow -- especially if it has to hit the network to determine
whether a proxy object is callable.

--
~Ethan~


More information about the Python-ideas mailing list