Skip to content
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

use 'callable' to check if object is callable (B004) #10081

Merged
merged 1 commit into from
Jan 10, 2022
Merged

use 'callable' to check if object is callable (B004) #10081

merged 1 commit into from
Jan 10, 2022

Conversation

danieleades
Copy link
Contributor

from the bugbear docs-

B004: Using hasattr(x, 'call') to test if x is callable is unreliable. If x implements custom getattr or its call is itself not callable, you might get misleading results. Use callable(x) for consistent results.

also, it looks better.

@tk0miya tk0miya added this to the 4.4.0 milestone Jan 10, 2022
@tk0miya tk0miya merged commit e79681c into sphinx-doc:4.x Jan 10, 2022
@tk0miya
Copy link
Member

tk0miya commented Jan 10, 2022

Cool!

@danieleades danieleades deleted the refactor/callable-test branch January 10, 2022 17:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants