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

Clarify inspect.is<callable> method docs #49218

Closed
terryjreedy opened this issue Jan 17, 2009 · 4 comments
Closed

Clarify inspect.is<callable> method docs #49218

terryjreedy opened this issue Jan 17, 2009 · 4 comments
Labels
docs Documentation in the Doc dir

Comments

@terryjreedy
Copy link
Member

BPO 4968
Nosy @birkenfeld, @terryjreedy

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:

assignee = None
closed_at = <Date 2010-10-15.16:53:38.086>
created_at = <Date 2009-01-17.03:26:08.466>
labels = ['docs']
title = 'Clarify inspect.is<callable> method docs'
updated_at = <Date 2010-10-15.16:53:38.085>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2010-10-15.16:53:38.085>
actor = 'georg.brandl'
assignee = 'docs@python'
closed = True
closed_date = <Date 2010-10-15.16:53:38.086>
closer = 'georg.brandl'
components = ['Documentation']
creation = <Date 2009-01-17.03:26:08.466>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 4968
keywords = []
message_count = 4.0
messages = ['79999', '109272', '109968', '118802']
nosy_count = 4.0
nosy_names = ['georg.brandl', 'terry.reedy', 'docs@python', 'BreamoreBoy']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue4968'
versions = ['Python 3.1', 'Python 3.2']

@terryjreedy
Copy link
Member Author

inspect module in 3.0

.isclass: says "Return true if the object is a class." Since the issue
of builtin versus Python coded is involved in all the other methods
below, I would expand this to
"Return true if the object is a class, whether built-in or Python-coded."
to emphasize that this is not an issue for this one.

.isfunction: current "Return true if the object is a Python function or
unnamed (lambda) function." falsely implies that there is such a thing
as 'unnamed (lambda) function; different from 'Python function'. By
test, it just returns True for 'function' objects. Suggestion:

"Return true for Python-coded functions, including unbound Python-coded
methods." or possibly
"Return true for functions created by def statements and lambda
expressions, including unbound Python-coded methods.

.ismethod: "Return true if the object is a method." should be specified
to something like
"Return true if the object is a bound method written in Python."

.isbuiltin: says "Return true if the object is a built-in function."
but actually tests for membership in class 'builtin_function_or_method'.
I believe that truth is
"Return true if the object is a built-in function (but not a class) or a
bound built-in non-special method."
It is True, for instance, for [].append but not [].__hash__. I am
assuming that this behavior is intended and not a bug.

.ismethoddescriptor: "Return true if the object is a method descriptor,
but not if ismethod() or isclass() or isfunction() are true." begs the
question of what a method descriptor is. I believe the following is
both true and clearer.
"Return true if the object is a built-in method and isbuiltin() is false.

I would follow with
"The methods isclass, isfunction, ismethod, isbuiltin, and
ismethoddescriptor are mutually exclusive."
I believe the following is true, and could be added also.
"Exact one is true for any instance of a built-in callable class."

@terryjreedy terryjreedy added the docs Documentation in the Doc dir label Jan 17, 2009
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Jul 4, 2010

Has this issue simply slipped under the radar?

@birkenfeld
Copy link
Member

No, I've just had no time to review the suggested changes.

@birkenfeld birkenfeld assigned docspython and unassigned birkenfeld Jul 11, 2010
@birkenfeld
Copy link
Member

Committed suggestions with a few changes in r85541.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants