A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-April/072519.html below:

[Python-Dev] concerns regarding callable() method

[Python-Dev] concerns regarding callable() method [Python-Dev] concerns regarding callable() methodAlexey Borzenkov snaury at gmail.com
Sun Apr 8 17:57:47 CEST 2007
On 4/8/07, Paul Pogonyshev <pogonyshev at gmx.net> wrote:
> > 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 ;)

I whole-heartedly agree here, because people who start learning python
(like me some time ago) usually learn that it's bad to test for
__call__ (can't remember where I read about that though), and that we
should always use callable() to be on a safe side. When I first heard
that callable() was going to be removed I kinda panicked myself, it's
good to know that at least there's still a way to be sure that object
is callable or not...
More information about the Python-Dev mailing list

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