Guido van Rossum wrote: > On 4/8/07, Paul Pogonyshev <pogonyshev at gmx.net> wrote: > > Additionally consider something like > > > > something.set_callback (x) > > > > Assume that set_callback() wants to check if `x' is callable at > > all, to raise exception early and make error tracking easier. > > Currently, you can > > > > assert callable (x) > > > > But if callable() is removed, there is no apparent replacement. Of > > course, you cannot call `x' since it might have side-effects or be > > slow etc. > > assert hasattr(x, '__call__') > > I note that callable() was introduced before all callable objects had > a __call__ attribute. This is no longer the case, so it's not needed. I just didn't think about that possibility. If that works the same way, callable() is just a sugar and not something unimplementable in other ways. Therefore, my objection is discarded. (But PEP 3100 should probably be update to mention this, otherwise you may get this complaint again ;) > > Please reconsider removal of callable() or provide an adequate > > replacement. > > What if someone passes a callable that doesn't have the expected signature? Well, I don't know a way to catch such situations now, so removing callable() will not make it worse (even if you don't know about hasattr trick above.) Paul
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4