This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: "Built-in Functions" not being functions
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.3, Python 3.4, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Stefan Pochmann, docs@python, lemburg, r.david.murray, rhettinger, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-02-16 17:32 by Stefan Pochmann, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg287961 - (view) Author: Stefan Pochmann (Stefan Pochmann) * Date: 2017-02-16 17:32
About https://docs.python.org/3/library/functions.html: The title "Built-in Functions", the table header "Built-in Functions" and the "functions" in the URL all suggest that what's on this page are functions. But many things on that page don't appear to be functions, like "range" or "dict". They appear to be callable types instead. For example "range":

    >>> type(range)
    <class 'type'>
    >>> import types
    >>> isinstance(range, types.FunctionType)
    False
    >>> isinstance(range, types.BuiltinFunctionType)
    False

Compare with "abs":

    >>> type(abs)
    <class 'builtin_function_or_method'>
    >>> isinstance(abs, types.FunctionType)
    False
    >>> isinstance(abs, types.BuiltinFunctionType)
    True

The text between title and table talks about "functions and types", but the title/tableheader/URL disagree.

Also, the table is wrong in saying that "abs()" etc are functions. Should say "abs" instead, i.e., remove the "()".

Many, like "abs", aren't even allowed to be called like that, as it results in "TypeError: abs() takes exactly one argument (0 given)".
msg287962 - (view) Author: Stefan Pochmann (Stefan Pochmann) * Date: 2017-02-16 17:43
The page also contains many references like "As repr(), return a string containing..." where the "()" should be removed.
msg287965 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-02-16 18:00
While "functions" may not be accurate anymore, they are all callables.

Historically, those callables were functions. Later on some of the built-ins were replaced with type objects.

Regarding your last comment: It is common in Python to write "func()" for callables in Python. The "()" signal the callable property.
msg287967 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-02-16 19:30
Agreed with Marc.  I don't think there is anything to do here.  The fact that python allows classes (which are callables) to be substituted for functions is a strength, but can lead to confusion (and people getting upset when classes end up with lowercase names :)

I think it would be more confusing than helpful to say "Built-in Callables".
msg288051 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-02-18 01:39
I concur with the other respondents and am going to mark this as closed.
msg288155 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-19 19:09
See also issue11975.
History
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73766
2017-02-19 19:09:18serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg288155
2017-02-18 01:39:31rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg288051

resolution: not a bug
stage: resolved
2017-02-16 19:30:54r.david.murraysetnosy: + r.david.murray
messages: + msg287967
2017-02-16 18:00:48lemburgsetnosy: + lemburg
messages: + msg287965
2017-02-16 17:43:13Stefan Pochmannsetmessages: + msg287962
2017-02-16 17:32:50Stefan Pochmanncreate