[Python-ideas] Fix that broken callable builtin

Ionel Cristian Mărieș contact at ionelmc.ro
Sat Apr 18 00:34:14 CEST 2015


Ah, yes, someone else has already made a patch here:
http://bugs.python.org/file39090/callable.diff

This is the issue: http://bugs.python.org/issue23990

Would you add your thoughts there?


Thanks,
-- Ionel Cristian Mărieș, http://blog.ionelmc.ro

On Sat, Apr 18, 2015 at 1:19 AM, Guido van Rossum <guido at python.org> wrote:

> So propose a patch for callable() along these lines. It'll have to be C
> code.
>
> On Fri, Apr 17, 2015 at 2:21 PM, Ionel Cristian Mărieș <contact at ionelmc.ro
> > wrote:
>
>> Yes indeed, that's one way but I wouldn't want to monkeypatch the
>> `callable` builtin. People wouldn't expect that library would even dare
>> monkeypatch builtin.
>>
>>
>> Thanks,
>> -- Ionel Cristian Mărieș, http://blog.ionelmc.ro
>>
>> On Sat, Apr 18, 2015 at 12:10 AM, Ethan Furman <ethan at stoneleaf.us>
>> wrote:
>>
>>> On 04/18, Ionel Cristian Mărieș wrote:
>>>
>>> > Also there's the issue about not being able to implement a true proxy
>>> (as
>>> > outlined before).
>>>
>>> Proxies are a bit of a pain.  But you can create your own callable
>>> function.
>>>
>>> Something like (untested):
>>>
>>> def callable(obj):
>>>     try:
>>>         func = obj.__call__
>>>         return True
>>>     except AttributeError:
>>>         return False
>>>
>>> --
>>> ~Ethan~
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150418/a05b2cd4/attachment-0001.html>


More information about the Python-ideas mailing list