Introduce "__python__" built-in attribute

TL/DR: A new built-in attribute who's purpose is to provide a simple way for developers to detect the Python implementation like CPython, JPython, IronPython and PyPy among other information. Ok, so the reason I'm suggesting this is for another suggestion I'll submit a later date (once I feel this one has ran it's course, or the contributors decide about it). The goal of this attribute (as mentioned above) is to provide developers quick and simple information about the Python runtime like whether or not it's running on CPython or PyPy and other details. Key information this attribute provides is implementation's name (ex: CPython), implementation's version (may be independent of Python's) and Python's version (ex: 3.10) Optional information can include the platform's name/architecture, whether or not it's a JIT/Interpreter/BOTH environment. This attribute is also flexible so implementators can also provide attributes to show information like whether or not it mimics another implementation, or information unique (or mimic'd) about it. Another TL/DR: I suck at communicating ideas across, but I hope you get the idea behind it.

This is called sys.version, right? On Thu, Nov 19, 2020, 3:21 PM William Pickard <lollol222gg@gmail.com> wrote:
TL/DR: A new built-in attribute who's purpose is to provide a simple way for developers to detect the Python implementation like CPython, JPython, IronPython and PyPy among other information.
Ok, so the reason I'm suggesting this is for another suggestion I'll submit a later date (once I feel this one has ran it's course, or the contributors decide about it). The goal of this attribute (as mentioned above) is to provide developers quick and simple information about the Python runtime like whether or not it's running on CPython or PyPy and other details.
Key information this attribute provides is implementation's name (ex: CPython), implementation's version (may be independent of Python's) and Python's version (ex: 3.10) Optional information can include the platform's name/architecture, whether or not it's a JIT/Interpreter/BOTH environment. This attribute is also flexible so implementators can also provide attributes to show information like whether or not it mimics another implementation, or information unique (or mimic'd) about it.
Another TL/DR: I suck at communicating ideas across, but I hope you get the idea behind it. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/NF354O... Code of Conduct: http://python.org/psf/codeofconduct/

Also there is sys.implementation On Thu, Nov 19, 2020, 11:25 PM David Mertz <mertz@gnosis.cx> wrote:
This is called sys.version, right?
On Thu, Nov 19, 2020, 3:21 PM William Pickard <lollol222gg@gmail.com> wrote:
TL/DR: A new built-in attribute who's purpose is to provide a simple way for developers to detect the Python implementation like CPython, JPython, IronPython and PyPy among other information.
Ok, so the reason I'm suggesting this is for another suggestion I'll submit a later date (once I feel this one has ran it's course, or the contributors decide about it). The goal of this attribute (as mentioned above) is to provide developers quick and simple information about the Python runtime like whether or not it's running on CPython or PyPy and other details.
Key information this attribute provides is implementation's name (ex: CPython), implementation's version (may be independent of Python's) and Python's version (ex: 3.10) Optional information can include the platform's name/architecture, whether or not it's a JIT/Interpreter/BOTH environment. This attribute is also flexible so implementators can also provide attributes to show information like whether or not it mimics another implementation, or information unique (or mimic'd) about it.
Another TL/DR: I suck at communicating ideas across, but I hope you get the idea behind it. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/NF354O... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PV4BET... Code of Conduct: http://python.org/psf/codeofconduct/

On Thu, Nov 19, 2020 at 08:21:26PM -0000, William Pickard wrote:
TL/DR: A new built-in attribute who's purpose is to provide a simple way for developers to detect the Python implementation like CPython, JPython, IronPython and PyPy among other information.
>>> import sys >>> sys.implementation.name 'cpython' -- Steve

There's `platform.python_implementation()` (https://docs.python.org/3.8/library/platform.html). Although __implementation__ might be a better name if it was to be implemented.
participants (5)
-
Batuhan Taskaya
-
David Mertz
-
Hedy Li
-
Steven D'Aprano
-
William Pickard