Python
Python
Guido van Rossum began working on Python in the late 1980s as a successor to
the ABC programming language and first released it in 1991 as Python 0.9.0.
[36]
Python 2.0 was released in 2000. Python 3.0, released in 2008, was a major
revision not completely backward-compatible with earlier versions. Python 2.7.18,
released in 2020, was the last release of Python 2.[37]
Python consistently ranks as one of the most popular programming languages, and
has gained widespread use in the machine learning community.[38][39][40][41]
History
[edit]
Main article: History of Python
The name Python is said to come from the British comedy series Monty Python's
Flying Circus.[48]
Python 2.0 was released on 16 October 2000, with many major new features such
as list comprehensions, cycle-detecting garbage collection, reference counting,
and Unicode support.[49] Python 2.7's end-of-life was initially set for 2015, then
postponed to 2020 out of concern that a large body of existing code could not easily
be forward-ported to Python 3.[50][51] No further security patches or other improvements
will be released for it.[52][53] While Python 2.7 and older versions are officially
unsupported, a different unofficial Python implementation, PyPy, continues to
support Python 2, i.e. "2.7.18+" (plus 3.10), with the plus meaning (at least some)
"backported security updates".[54]
Python 3.0 was released on 3 December 2008, with some new semantics and
changed syntax. At least every Python release since (now unsupported) 3.5 has
added some syntax to the language, and a few later releases have dropped outdated
modules, or changed semantics, at least in a minor way.
Since 7 October 2024, Python 3.13 is the latest stable release, and it and, for few
more months, 3.12 are the only releases with active support including for bug fixes
(as opposed to just for security) and Python 3.9,[55] is the oldest supported version of
Python (albeit in the 'security support' phase), due to Python 3.8 reaching end-of-life.
[56][57]
Starting with 3.13, it and later versions have 2 years of full support (up from one
and a half), followed by 3 years of security support (for same total support as
before).
Security updates were expedited in 2021 (and again twice in 2022, and more fixed in
2023 and in September 2024 for Python 3.12.6 down to 3.8.20), since all Python
versions were insecure (including 2.7[58]) because of security issues leading to
possible remote code execution[59] and web-cache poisoning.[60]
Python 3.10 added the | union type operator[61] and the match and case keywords (for
structural pattern matching statements). 3.11 expanded exception
handling functionality. Python 3.12 added the new keyword type. Notable changes in
3.11 from 3.10 include increased program execution speed and improved error
reporting.[62] Python 3.11 claims to be between 10 and 60% faster than Python 3.10,
and Python 3.12 adds another 5% on top of that. It also has improved error
messages (again improved in 3.14), and many other changes.
Python 3.13 introduces more syntax for types, a new and improved interactive
interpreter (REPL), featuring multi-line editing and color support; an incremental
garbage collector (producing shorter pauses for collection in programs with a lot of
objects, and addition to the improved speed in 3.11 and 3.12), and
an experimental just-in-time (JIT) compiler (such features, can/needs to be enabled
specifically for the increase in speed),[63] and an experimental free-threaded build
mode, which disables the global interpreter lock (GIL), allowing threads to run more
concurrently, that latter feature enabled with python3.13t or python3.13t.exe.
Python 3.13 introduces some change in behavior, i.e. new "well-defined semantics",
fixing bugs (plus many removals of deprecated classes, functions and methods, and
removed some of the C API and outdated modules): "The [old] implementation
of locals() and frame.f_locals is slow, inconsistent and buggy [and it] has many
corner cases and oddities. Code that works around those may need to be changed.
Code that uses locals() for simple templating, or print debugging, will continue to
work correctly."[64]
Some (more) standard library modules and many deprecated classes, functions and
methods, will be removed in Python 3.15 or 3.16.[65][66]
Python 3.11 adds Sigstore digital verification signatures for all CPython artifacts (in
addition to PGP). Since use of PGP has been criticized by security practitioners
Python is moving to Sigstore exclusively and dropping PGP from 3.14.[67]
Python 3.14 is now in alpha 3; regarding possible change to annotations: "In Python
3.14, from __future__ import annotations will continue to work as it did before,
converting annotations into strings."[68]
PEP 711 proposes PyBI: a standard format for distributing Python Binaries. [69]
Python 3.15 will "Make UTF-8 mode default",[70] the mode exists in all current Python
versions, but currently needs to be opted into. UTF-8 is already used, by default, on
Windows (and elsewhere), for most things, but e.g. to open files it's not and enabling
also makes code fully cross-platform, i.e. use UTF-8 for everything on all platforms.
Python uses dynamic typing and a combination of reference counting and a cycle-
detecting garbage collector for memory management.[77] It uses dynamic name
resolution (late binding), which binds method and variable names during program
execution.
Its design offers some support for functional programming in the Lisp tradition. It
has filter,mapandreduce functions; list comprehensions, dictionaries, sets,
and generator expressions.[78] The standard library has two modules
(itertools and functools) that implement functional tools borrowed
from Haskell and Standard ML.[79]
Its core philosophy is summarized in the Zen of Python (PEP 20), which
includes aphorisms such as:[80]
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Readability counts.
However, Python features regularly violate these principles and have received
criticism for adding unnecessary language bloat.[81] Responses to these criticisms are
that the Zen of Python is a guideline rather than a rule.[82] The addition of some new
features had been so controversial that Guido van Rossum resigned as Benevolent
Dictator for Life following vitriol over the addition of the assignment expression
operator in Python 3.8.[83][84]
Nevertheless, rather than building all of its functionality into its core, Python was
designed to be highly extensible via modules. This compact modularity has made it
particularly popular as a means of adding programmable interfaces to existing
applications. Van Rossum's vision of a small core language with a large standard
library and easily extensible interpreter stemmed from his frustrations with ABC,
which espoused the opposite approach.[42]
Python claims to strive for a simpler, less-cluttered syntax and grammar while giving
developers a choice in their coding methodology. In contrast to Perl's "there is more
than one way to do it" motto, Python embraces a "there should be one—and
preferably only one—obvious way to do it." philosophy.[80] In practice, however,
Python provides many ways to achieve the same task. There are, for example, at
least three ways to format a string literal, with no certainty as to which one a
programmer should use.[85] Alex Martelli, a Fellow at the Python Software
Foundation and Python book author, wrote: "To describe something as 'clever'
is not considered a compliment in the Python culture."[86]
Python's developers aim for it to be fun to use. This is reflected in its name—a tribute
to the British comedy group Monty Python[89]—and in occasionally playful approaches
to tutorials and reference materials, such as the use of the terms "spam" and "eggs"
(a reference to a Monty Python sketch) in examples, instead of the often-used "foo"
and "bar".[90][91] A common neologism in the Python community is pythonic, which has
a wide range of meanings related to program style. "Pythonic" code may use
Python idioms well, be natural or show fluency in the language, or conform with
Python's minimalist philosophy and emphasis on readability. Code that is difficult to
understand or reads like a rough transcription from another programming language
is called unpythonic.[92]
ython is a high-level, general-purpose programming language. Its design philosophy
emphasizes code readability with the use of significant indentation.[33]
Guido van Rossum began working on Python in the late 1980s as a successor to
the ABC programming language and first released it in 1991 as Python 0.9.0.
[36]
Python 2.0 was released in 2000. Python 3.0, released in 2008, was a major
revision not completely backward-compatible with earlier versions. Python 2.7.18,
released in 2020, was the last release of Python 2.[37]
Python consistently ranks as one of the most popular programming languages, and
has gained widespread use in the machine learning community.[38][39][40][41]
History
[edit]
The name Python is said to come from the British comedy series Monty Python's
Flying Circus.[48]
Python 2.0 was released on 16 October 2000, with many major new features such
as list comprehensions, cycle-detecting garbage collection, reference counting,
and Unicode support.[49] Python 2.7's end-of-life was initially set for 2015, then
postponed to 2020 out of concern that a large body of existing code could not easily
be forward-ported to Python 3.[50][51] No further security patches or other improvements
will be released for it.[52][53] While Python 2.7 and older versions are officially
unsupported, a different unofficial Python implementation, PyPy, continues to
support Python 2, i.e. "2.7.18+" (plus 3.10), with the plus meaning (at least some)
"backported security updates".[54]
Python 3.0 was released on 3 December 2008, with some new semantics and
changed syntax. At least every Python release since (now unsupported) 3.5 has
added some syntax to the language, and a few later releases have dropped outdated
modules, or changed semantics, at least in a minor way.
Since 7 October 2024, Python 3.13 is the latest stable release, and it and, for few
more months, 3.12 are the only releases with active support including for bug fixes
(as opposed to just for security) and Python 3.9,[55] is the oldest supported version of
Python (albeit in the 'security support' phase), due to Python 3.8 reaching end-of-life.
[56][57]
Starting with 3.13, it and later versions have 2 years of full support (up from one
and a half), followed by 3 years of security support (for same total support as
before).
Security updates were expedited in 2021 (and again twice in 2022, and more fixed in
2023 and in September 2024 for Python 3.12.6 down to 3.8.20), since all Python
versions were insecure (including 2.7[58]) because of security issues leading to
possible remote code execution[59] and web-cache poisoning.[60]
Python 3.10 added the | union type operator[61] and the match and case keywords (for
structural pattern matching statements). 3.11 expanded exception
handling functionality. Python 3.12 added the new keyword type. Notable changes in
3.11 from 3.10 include increased program execution speed and improved error
reporting.[62] Python 3.11 claims to be between 10 and 60% faster than Python 3.10,
and Python 3.12 adds another 5% on top of that. It also has improved error
messages (again improved in 3.14), and many other changes.
Python 3.13 introduces more syntax for types, a new and improved interactive
interpreter (REPL), featuring multi-line editing and color support; an incremental
garbage collector (producing shorter pauses for collection in programs with a lot of
objects, and addition to the improved speed in 3.11 and 3.12), and
an experimental just-in-time (JIT) compiler (such features, can/needs to be enabled
specifically for the increase in speed),[63] and an experimental free-threaded build
mode, which disables the global interpreter lock (GIL), allowing threads to run more
concurrently, that latter feature enabled with python3.13t or python3.13t.exe.
Python 3.13 introduces some change in behavior, i.e. new "well-defined semantics",
fixing bugs (plus many removals of deprecated classes, functions and methods, and
removed some of the C API and outdated modules): "The [old] implementation
of locals() and frame.f_locals is slow, inconsistent and buggy [and it] has many
corner cases and oddities. Code that works around those may need to be changed.
Code that uses locals() for simple templating, or print debugging, will continue to
work correctly."[64]
Some (more) standard library modules and many deprecated classes, functions and
methods, will be removed in Python 3.15 or 3.16.[65][66]
Python 3.11 adds Sigstore digital verification signatures for all CPython artifacts (in
addition to PGP). Since use of PGP has been criticized by security practitioners
Python is moving to Sigstore exclusively and dropping PGP from 3.14.[67]
Python 3.14 is now in alpha 3; regarding possible change to annotations: "In Python
3.14, from __future__ import annotations will continue to work as it did before,
converting annotations into strings."[68]
PEP 711 proposes PyBI: a standard format for distributing Python Binaries. [69]
Python 3.15 will "Make UTF-8 mode default",[70] the mode exists in all current Python
versions, but currently needs to be opted into. UTF-8 is already used, by default, on
Windows (and elsewhere), for most things, but e.g. to open files it's not and enabling
also makes code fully cross-platform, i.e. use UTF-8 for everything on all platforms.
Python uses dynamic typing and a combination of reference counting and a cycle-
detecting garbage collector for memory management.[77] It uses dynamic name
resolution (late binding), which binds method and variable names during program
execution.
Its design offers some support for functional programming in the Lisp tradition. It
has filter,mapandreduce functions; list comprehensions, dictionaries, sets,
and generator expressions.[78] The standard library has two modules
(itertools and functools) that implement functional tools borrowed
from Haskell and Standard ML.[79]
Its core philosophy is summarized in the Zen of Python (PEP 20), which
includes aphorisms such as:[80]
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Readability counts.
However, Python features regularly violate these principles and have received
criticism for adding unnecessary language bloat.[81] Responses to these criticisms are
that the Zen of Python is a guideline rather than a rule.[82] The addition of some new
features had been so controversial that Guido van Rossum resigned as Benevolent
Dictator for Life following vitriol over the addition of the assignment expression
operator in Python 3.8.[83][84]
Nevertheless, rather than building all of its functionality into its core, Python was
designed to be highly extensible via modules. This compact modularity has made it
particularly popular as a means of adding programmable interfaces to existing
applications. Van Rossum's vision of a small core language with a large standard
library and easily extensible interpreter stemmed from his frustrations with ABC,
which espoused the opposite approach.[42]
Python claims to strive for a simpler, less-cluttered syntax and grammar while giving
developers a choice in their coding methodology. In contrast to Perl's "there is more
than one way to do it" motto, Python embraces a "there should be one—and
preferably only one—obvious way to do it." philosophy.[80] In practice, however,
Python provides many ways to achieve the same task. There are, for example, at
least three ways to format a string literal, with no certainty as to which one a
programmer should use.[85] Alex Martelli, a Fellow at the Python Software
Foundation and Python book author, wrote: "To describe something as 'clever'
is not considered a compliment in the Python culture."[86]
Python's developers aim for it to be fun to use. This is reflected in its name—a tribute
to the British comedy group Monty Python[89]—and in occasionally playful approaches
to tutorials and reference materials, such as the use of the terms "spam" and "eggs"
(a reference to a Monty Python sketch) in examples, instead of the often-used "foo"
and "bar".[90][91] A common neologism in the Python community is pythonic, which has
a wide range of meanings related to program style. "Pythonic" code may use
Python idioms well, be natural or show fluency in the language, or conform with
Python's minimalist philosophy and emphasis on readability. Code that is difficult to
understand or reads like a rough transcription from another programming language
is called unpythonic.[92]