[issue40970] Error in Python Datamodel Documentation
New submission from Christopher Yeh : The documentation says the following: > A built-in function object is a wrapper around a C function. Examples of > built-in functions are `len` and `math.sin` (`math` is a standard built-in > module). However, `math` is not always a built-in module, as can be seen in on my own Python installation (Windows 10, WSL 1, Python 3.7.7 installed via conda). >>> import sys >>> sys.builtin_module_names ('_abc', '_ast', '_codecs', '_collections', '_functools', '_imp', '_io', '_locale', '_operator', '_signal', '_sre', '_stat', '_string', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', 'atexit', 'builtins', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'posix', 'pwd', 'sys', 'time', 'xxsubtype', 'zipimport') Therefore, I have submitted a pull request to remove the statement "(`math` is a standard built-in module)" from the documentation. -- assignee: docs@python components: Documentation messages: 371473 nosy: chrisyeh, docs@python priority: normal pull_requests: 20055 severity: normal status: open title: Error in Python Datamodel Documentation type: enhancement versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40970> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40970] Error in Python Datamodel Documentation
Christopher Yeh added the comment: Here's the output from my terminal comparing the `math` standard library module (not always built-in) against the `sys` standard library module (always built-in). On Windows 10 x64, WSL 1, Ubuntu 18.04.02 LTS, Python 3.7.7 installed via conda: math is not a built-in module. $ python Python 3.7.7 (default, Mar 26 2020, 15:48:22) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import math >>> print(math) >>> print(type(math)) >>> import sys >>> print(sys) >>> print(type(sys)) On Windows 10 x64, Python installed directly from Python.org: math is a built-in module. C:\>python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import math >>> print(math) >>> print(type(math)) >>> import sys >>> print(sys) >>> print(type(sys)) -- ___ Python tracker <https://bugs.python.org/issue40970> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40970] Error in Python Datamodel Documentation
Christopher Yeh added the comment: I understand the two uses of the phrase "built-in": 1) to refer to things included with the Python interpreter (e.g. modules in sys.builtin_module_names, and built-in functions like len() and ord()) 2) to refer to things included with Python that are written in C However, I find it fairly difficult to distinguish between the two uses in the context presented: > A built-in function object is a wrapper around a C function. Examples of > built-in functions are `len` and `math.sin` (`math` is a standard built-in > module). Within the Python Language Reference (docs.python.org/3/reference), this is actually the only case where definition (2) applies, as far as I can tell: https://www.google.com/search?q="built-in+module"+site%3Ahttps%3A%2F%2Fdocs.python.org%2F3%2Freference%2F Also, I am not sure that the parenthetical about `math` being a module written in C adds any additional clarity. -- ___ Python tracker <https://bugs.python.org/issue40970> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com