-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring back callable() #54727
Comments
It was just resting. Here is a patch to wake it up for 3.2 (or 3.3 pending moratorium interpretation). As for the py3k warning in 2.x (and the 2to3 fixer), it's not obvious what we should do: callable() clearly doesn't exist in 3.0 and 3.1. |
I think we should lift the py3k warning after 3.2 is released, but leave the 2to3 fixer in for the time being. |
Does the plan include deprecating collections.Callable? |
What is the reason for this? Why do we need it? |
I'm not sure it's worth bringing callable() back at this point. def callable(obj):
return isinstance(obj, collections.Callable) If it goes in the |
I was originally surprised to find that callable() was gone. I pointed it out at Europython and got a very informative explanation from Brett. The isinstance(obj, collections.Callable) was introduced and it works well. I'm with Ezio here. I'm -1 for callable(), +0 for iscallable() (there should be preferably one obvious way to do it and using isinstance() seems to be that way at this point). |
The thing is, "isisinstance(x, collections.Callable)" is hardly obvious |
Bringing back callable but with a different name is horrible. Just bring it back for goodness sake. |
Just for the reference: "What's new in Python 3.0" page says:
There doesn't seem to be any indication than in two-versions time anyone would feel a need to resurrect it. It might be not "obvious", but it's consistent with the check for other attributes. And I doubt that it's any more non-obvious than the need to use it in a first place. |
Well, Guido has already approved its return - so further debate is relatively pointless. (Not that that usually stops us...) |
surely, such a relevant bit of information is worth linking to! |
It was on python-ideas in the recent thread about bringing back callable. Feel free to post a link here for the record. |
I wouldn't consider it "approving", what Guido says is:
<http://mail.python.org/pipermail/python-ideas/2010-November/008747.html\> Which incidentally is in response to your e-mails with the actual discussion following it. |
I don't know what attributes you're talking about, and there doesn't seem to be a lot of consistency there. |
Committed in r86842. |
I thought PEP-3003 was quite unambiguous:
|
Le samedi 27 novembre 2010 à 22:23 +0000, SilentGhost a écrit :
The stated goal of the moratorium is to make it easier for alternate I wouldn't claim this is a authoritative interpretation but, if Guido |
I thought that moratorium meant Guido dis/approval is not applicable to the 3.2 Another listed change was help ease adoption of py3k. How's that helping? |
2010/11/27 SilentGhost <report@bugs.python.org>:
By causing one less discontinuity. |
Guido can decide of everything: PEPs, etc. That's what "BDFL" means.
How's it not helping? I'm not sure what your general point or concern is. Do you have a real |
yes, my problem is that callable was removed and a way was shown how to do this check. The way which is consistent with the check for any other type (ABC). Now out of the blue, w/o any justification this way is going to be ignored, because "ah, sure. I can't be bothered typing extra three characters" and the old function is reintroduced. I don't like that we're heading into Perl's direction. that's all. |
ABCs are still the exception in Python, and duck typing is still the
Well, please deal with it. |
Then why do we callable again? Don't worry, I'll deal with it. It's not like this whole discussion mattered. |
Because the way __call__ is looked up means hasattr(x, "__call__") is |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: