Python (programming language): Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Aleksander Stos
m (→‎External links: localized)
mNo edit summary
 
(61 intermediate revisions by 14 users not shown)
Line 1: Line 1:
'''Python''' is a dynamic object-oriented, general purpose interpreted programming language which runs on many different computer platforms and mobile devices. Python is [[open source software]] and is published under an OSI-approved license. Python aims to be a language that is efficient, coherent, readable, and fun to use. Because Python is an interpreted language, Python programs run immediately without the need for lengthy compile and link steps.
{{subpages}}
{{dambigbox|Python (programming language)|Python}}
{{Authors|Kirby Urner}}
{{TOC|right}}
'''Python''' is a dynamic object-oriented, general purpose [[Programming_language#Compiled_vs._interpreted|interpreted programming language]].


==History==
==Origins==
Python was published by Guido van Rossum in 1991, and to this day, Guido remains the project leader.


Python reached version 1.0 in 1994.
Python, the computer language, was first designed and implemented on an Apple Lisa, a forerunner of the more reasonably priced Macintosh. Written in the C language, by Guido van Rossum, Python was meant as a next generation ABC, the name of a shell-based interactive language, used in house at Stichting Mathematisch Centrum (Amsterdam), the think tank where Guido, a Dutchman, then worked (circa 1991).


==Examples==
Python, like ABC before it, was created for busy professionals already well versed in technical disciplines and needing to avail themselves of computing power without detouring into computer science for yet another degree. The Python language “fits your brain” (gets out of the way) and comes with “batteries included” (lots of libraries).


===Hello World===
That the language could live up to its own hype is testament to Guido’s strong sense of design and resistance to cruft (unnecessary complexity). The language has only two looping constructs for example, based on keywords '''while''' and '''for'''. Coders extend the built-in type system using the keyword '''class''' to define new types.
The code for the "hello world" program can hardly be simpler:


<code> print 'Hello World'</code>
“Computer Programming for Everybody” (CP4E) was Guido’s rallying cry, later the title of his successful DARPA proposal, but he wasn’t reinventing BASIC. Python would be architected from the ground up to be object oriented and state of the art.


This can be put in a file "hello.py", say, and executed with
  class Snake:
      """
      Defining a type: a snake with a name and stomach
      """
      def __init__(self, name):
          self.name = name
          self.stomach = [ ] # empty at birth
 
      def eat(self, food):
          self.stomach.append(food)
      # any_snake("🐹") synonymous with any_snake.eat("🐹")
      def __call__(self, food):
          self.eat(food)
      def __repr__(self):
          return f"Snake named {self.name} at {id(self)}"


<code> python hello.py </code>
Like Java, Python would compile from source code to an interim bytecode language that would run on a [[Virtual machine|virtual machine]]. Although strongly typed, name bindings could change at runtime, meaning no type declarations up front, making Python a (very) high level language, and therefore slower and more memory hungry than languages with tinier runtimes, such as Rust.
Python includes runtime garbage collecting of no longer used objects, and dynamically allocates more memory as objects require.


from the usual command line of the operating system. Alternatively, the code can be typed directly in an interactive Python environment (Python command line interpreter or [[IDLE (Python programming language)|IDLE]], which make parts of a standard Python distribution).
More pared-down faster relatives of Python, such as Cython, come down elsewhere along the flexibility, to runtime speed, tradeoff.


===Calculator===
Unlike in Java, free-standing function objects (outside any class) are allowed, and may be passed around as arguments, as in JavaScript.
Python interpreter invoked from the command line gives an easy access to a scientific calculator. At prompt (denoted here by <code> >>> </code>) one types


<code> >>> 2+3*(1+1)</code>
Also unlike Java, but like C++, operator overloading (changing the meaning of arithmetic symbols) is supported.


to get 8 in the result. Division of integers returns integer result, so
Even the behavior of brackets and parentheses — e.g. dog[] and cat() — may be altered on a per type basis, by providing code for the corresponding “special method names” such as: __add__ for +; __mul__ for *; __getitem__ and __setitem__ for brackets; and __call__ for parentheses.


<code> >>> 7/2</code>
Python has about fifty of such builtin “__ribs__” (i.e. special names). Mnemonic: “a snake has lots of __ribs__” (also known as “magic methods”).


is 3 ([[floor]] from the exact result). If a [[real number|real]] result is needed, then at least one ingredient should be 'real', as below
The conversation below, at the Python REPL (read evaluate print loop), or shell, makes use of the Snake type defined above.  Calling the type (Snake) triggers the constructor (__init__), with Python supplying the leftmost argument (self). Once an instance is defined (e.g. naga), directly calling it (an optional feature) triggers the __call__ method, which in turn invokes the eat method.


<code> >>> 7.0/2</code>
>>> any_snake = Snake("Naga") # triggers __init__
>>> any_snake("🐹")          # triggers __call__
>>> any_snake.eat("snack")    # appends to stomach
>>> any_snake.stomach        # accessing an attribute
['🐹', 'snack']
>>> any_snake                # triggers __repr__
Snake named Naga at 4634375632
>>> another_snake = Snake("Twila")
>>> another_snake
Snake named Twila at 4604937040


More interesting functions may be found in the <tt>math</tt> ''module''. This is how to use it.
==Early Success==


<code> >>> from math import *</code>
Python never billed itself as a “teaching language” or a “beginner language” and yet ended up fitting these billings inadvertently, because it looked like “runnable pseudo-code” (clear and compact).
<br>
<code> >>> print sin(pi/2)</code>


High quality graphs may be obtained with <tt>matplotlib</tt> library<ref>This is installed separately, see an [http://matplotlib.sourceforge.net/tutorial.html introduction] and a couple of [http://matplotlib.sourceforge.net/screenshots.html examples].</ref>
MIT and other top universities gradually gave it a more prominent position in their curricula, much to the dismay of purists who had grown up learning LISP, and thereby contributing to growing resentment in some corners.
The early success of Python may be attributed to two factors:


===Files===
# it rode the wave of the free and open source movement, meaning it enjoyed partaking of the most creative software development ecosystem ever devised and
A useful Python idiom is related to working with files. Line-by-line Perl-like file processing can be realized with a <code>for</code> loop as in the following simple word count script. Comments, as always in Python, start with the hash '#' sign and continue to the end of line.
# it ran well on Windows, itself proprietary, but ubiquitous, and likewise a platform for free open software development.
<pre>
(char_count,word_count,line_count)=0,0,0      # multiple assignment is OK
file = open ('myfile.txt')                    # standard opening of the file
for line in file:                            # this is the idiom
  wordlist = line.split()                    # splitting line into the list of words
  word_count += len(wordlist)                # counting words
  line_count += 1                            # counting lines
  char_count += len(line) - 1                # counting characters
print line_count, word_count, char_count      # we're done
</pre>


Notice the indentation that indicates what code is executed within the loop. This is the standard Python notation, a part of the syntax. When the end of file is reached, the loop terminates and the results are printed by the last line of the code. Note also that the variable <code>line</code> contains the terminating ''newline'' character, so that 1 is subtracted from its length for the character counting. Another interesting observation can be made: the method (i.e. function) of splitting a string is 'provided' by this very string. Indeed, Python is an objective language, the string variables are objects and related methods are its attributes.
Python’s stash of third party contributed packages, for game development, cryptography, physics modeling, and bioinformatics, exploded exponentially. In Python, as in Wolfram Language (Mathematica), scientists were discovering a cross-disciplinary lingua franca they could all develop in common.


===Internet access===
Not only did it run on Windows in a GUI-based development environment, but the very same IDE (named IDLE, a pun on Eric Idle of Monty Python fame) ran on OSX and Linux as well.


The following script counts the number of images on Citizendium [[Main Page]].
DARPA’s funding of the [https://www.python.org/doc/essays/cp4e/ CP4E proposal] had given Guido time to develop IDLE, a hybrid project wherein the graphical widgets came from Tk (toolkit) written in tcl (tickle) but with Python bindings via [https://docs.python.org/3/library/tkinter.html Tkinter]. To this day, Python leaves it to 3rd party libraries to provide GUI bindings ([https://www.wxpython.org/ wxPython], [https://www.riverbankcomputing.com/software/pyqt/ PyQT], [https://pypi.org/project/PyGTK/ PyGTK]…) to all but [https://www.tcl.tk/ Tk] (Tkinter is in the Standard Library).
<pre>
import urllib2                     
cnt=0
for line in urllib2.urlopen('http://en.citizendium.org/wiki/Main_Page'):
  cnt += line.count('<img src')
print cnt
</pre>
First, we import a module from the standard library. The latter is said to be rich and often regarded as Python's strong point. In fact, Python official pages declare a "batteries included" philosophy. Now, the source [[HTML]] files of web pages can be treated much like the local files, e.g. processed line-by-line with a <tt>for</tt> loop. In the above example the variable <tt>line</tt> is a string containing a piece of HTML code of Citizendium's Main Page. Embedded images are inserted in this code with a text that begins with '<img src'. So it's enough to count instances of this last string. The appropriate method <tt>count()</tt> is at hand ''in'' the variable <tt>line</tt>.


==Syntax==
[https://www.sqlalchemy.org/ SQLAlchemy] provided a sophisticated object relational mapper (ORM). [https://twistedmatrix.com/trac/ Twisted] supported all manner of TCP/IP protocols, while the [https://wsgi.readthedocs.io/en/latest/ WSGI standard] allowed for all manner of web serving frameworks.
Remarkable global features of the Python syntax include high readability of the code, which is not independent of the use of indentation to separate blocks of code and a general "one statement per line" principle.<ref>Backslash "\" at the end of line allows to break e.g. a long assignment over multiple lines. There is also a formal possibility to put more than one statement in a line by separating them with a semicolon. Still, the general principle shapes the code.</ref>


==Implementations==
[https://numpy.org/ Numpy] and [https://scipy.org/ Scipy], enjoying a boost from the astronomy community especially, added more significant number crunching (e.g. linear algebra) and other science-related algorithms to Python’s ecosystem.
Python's official distribution is known as CPython. It's written in C and functions as a virtual machine interpreting bytecode-compiled Python programs. Jython is an implementation for the [[Java Virtual Machine]], which can run either standalone (like CPython) or as an embedded scripting engine. IronPython is an implementation for the [[Common Language Runtime]] (.NET and Mono). PyPy is an implementation written in Python that targets several backends, including C, LLVM, JavaScript, JVM and CLR.


==See also==
Python became one of the “P languages” of the LAMP stack, joining PHP and Perl atop MySQL, Apache, and Linux. Many more stacks (too many to discuss here) were to follow.
* [[IDLE (Python programming language)|IDLE]], the Integrated Development Environment for Python


==Books==
==The Great Leap Forward==
*Beazley, David M. ''Python Essential Reference, 3rd Ed.'' Sams, 2006 ISBN 0672328623
*Chun, Wesley J. ''Core Python Programming, 2nd Ed.'' Prentice Hall, 2006 ISBN 0132269937
*Goerzen, John. ''Foundations Of Python Network Programming'' Apress, 2006 ISBN 1590593715
*Hetland, Magnus Lie. ''Beginning Python: From Novice To Professional'' Apress, 2005 ISBN 159059519X
*Lutz, Mark. ''Programming Python, 3rd Ed.'' O'Reilly, 2006 ISBN 0596009259
*Lutz, Mark and Ascher, David. ''Learning Python, 2nd Ed.'' O'Reilly, 2003 ISBN 0596002815
*Martelli, Alex. ''Python In A Nutshell, 2nd Ed.'' O'Reilly, 2006 ISBN 0596001886
*Martelli, Alex. Ravenscroft, Anna. Ascher, David. ''Python Cookbook, 2nd Ed.'' O'Reilly, 2005 ISBN 0596007973
*Zelle, John M. ''Python Programming: An Introduction To Computer Science'' Franklin Beedle, 2003 ISBN 1887902996


==External links==
Although already embraced by industry and ramping up as an inhouse favorite at many companies, Google especially (because of its ability to wrap C and C++ for interactive dynamic use), Guido came to realize his early draft had some ugly “warts” he should address. This entailed making some breaking changes that would make future Python source incompatible with the then-current version 2.x interpreter.


* [http://www.python.org/ Python Programming Language] Homepage
Already successful languages usually try to avoid upsetting the applecart, endangering their privileged position, but Guido, by then affectionately referred to as Benevolent Dictator for Life, announced these breaking changes would be coming with the move to Python 3.
* [http://docs.python.org/tut/tut.html Guido van Rossum's Introduction to Python]
 
* Richard Gruet's [http://rgruet.free.fr/PQR25/PQR2.5.html Python Reference Manual.] Contains also a compilation of useful Python-related resources (see 'Front matter').
Y2K hysteria was already in the air and somewhat in parody, in true Monty Python fashion, the Python Community touted Python 3000 as a part of the coming millennial apocalypse.
* [http://www.diveintopython.org/toc/index.html Dive into Python]
 
* [http://wwww.python-forum.org/py/index.php PythonForum.org]
1/2 would give a floating point answer (0.5) instead of an integer one (0). Use 1//2 instead for the latter. The print keyword would now be a builtin callable function (none of the keywords are callable). More deeply under the hood, more memory-light “just in time” constructs were introduced (e.g. range and zip), and programmed classes were more tightly unified with the pre-existing type system. Unicode support was more deeply integrated.
 
The language became more elegant and streamlined, laying a stronger foundation for future growth. Guido’s bold plans had paid off.
 
With its warts now addressed, Python 3 would go on to take the world by storm. The libraries became more powerful, and the 3rd party ecosystem ballooned with free frameworks.
 
In truth, Python web server solutions at first suffered from the bewildering variety of options, a disorienting cornucopia, such that Ruby on Rails ([[Ruby_(programming_language)|Ruby]] is a language more like Perl) began pulling ahead as an eclipsing technology with a stronger community. Community matters.
 
Python’s apparent saviors were Flask and Django, two high profile web serving solutions spanning the spectrum from micro to macro framework, in terms of infrastructure provided, from minimalist / expandable to fully loaded out of the box.
 
Around each project, a unique community developed. For example, Django grew out of a newspaper publishing community in Lawrence, Kansas, taking deadlines and documentation seriously and attracting an international league of top developers. Django jobs proliferated. Djangocon eventually abetted EuroPython and Pycon on the annual schedule of roaming conferences.
 
Additional examples of “Pythonista subcultures” would be the Blender (computer generated imagery) and ESRI (geographical information systems) communities. Both products, open and closed source respectively, are animated from within (scripted) using Python.
 
==Python Today==
 
By 2020, WSGI (Web Server Gateway Interface) was being abetted by ASGI (Asynchronous Server Gateway Interface), taking advantage of Python’s newest feature: the ability to define event loops of [https://qr.ae/pNqW1j asynchronous tasks] (coroutines) that may be nudged forward concurrently, in place of more complicated threading patterns.
 
HTTP / HTTPS has been enhanced with Websockets, a newer bidirectional web-oriented protocol, which ASGI likewise supports. The Django community was at the core of this effort, to keep Python abreast these latest changes in web server and API design.
Where Python really took off after around 2015 was in data science, owing to two trends:
 
1. Jupyter Notebook technology (oft rebranded), evolving from I-Python, itself a more developed interactive console environment than IDLE’s. Jupyter is incorporated into the popular Anaconda distribution, with DARPA funding again.
 
Jupyter Notebooks implement what Donald Knuth termed “literate programming” in that code cells intermix with “markdown cells” containing formatted text, graphics, hyperlinks. Other languages besides Python may run in code cells (“Jupyter” is from Julia, Python and R — early adopters). The Atlantic Monthly (April 5, 2018) predicted Jupyter Notebook technology would eventually revolutionize scientific publishing, as Notebooks encapsulate relevant runnable code in a publication-quality format.
 
2. the Machine Learning revolution, linked to the evolution of GPUs as generic number crunching devices, and of Python APIs to these new predictive data-fitting models. Google would introduce TensorFlow, whereas Facebook contributed the competing Pytorch. Scikit-learn provided an additional on ramp, complete with its own teaching materials.
 
Python was now competing with both Matlab and R, both inner sanctum graduate school tools not used to much competition.
 
Now seen as a “King of the Hill” in some ways, many languages would portray themselves as “the next Python” or the “Python killer” (shades of Greek mythology) as a way to gain traction and capitalize on some feelings of resentment and jealousy in light of Python’s evident success.
 
In the meantime, Guido encountered huge pushback gaining acceptance for a new assignment operator, the so-called walrus whiskers :=, and after achieving victory, announced that the language must be in good hands, since even as dictator he was barely able to make additional changes.
 
He took that as a sign of community maturity and demoted himself to exBDFL. He continued to work on the language however, and to play a mentoring role.


==Notes and references==
==Notes and references==
{{reflist}}
{{reflist}}[[Category:Suggestion Bot Tag]]
 
[[Category:CZ Live]]
[[Category:Computers Workgroup]]

Latest revision as of 16:00, 8 October 2024

This article is developing and not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.
This article is about Python (programming language). For other uses of the term Python, please see Python (disambiguation).
Authors [about]:
Kirby Urner
CZ is an open collaboration. Please
join in to develop this article!

Python is a dynamic object-oriented, general purpose interpreted programming language.

Origins

Python, the computer language, was first designed and implemented on an Apple Lisa, a forerunner of the more reasonably priced Macintosh. Written in the C language, by Guido van Rossum, Python was meant as a next generation ABC, the name of a shell-based interactive language, used in house at Stichting Mathematisch Centrum (Amsterdam), the think tank where Guido, a Dutchman, then worked (circa 1991).

Python, like ABC before it, was created for busy professionals already well versed in technical disciplines and needing to avail themselves of computing power without detouring into computer science for yet another degree. The Python language “fits your brain” (gets out of the way) and comes with “batteries included” (lots of libraries).

That the language could live up to its own hype is testament to Guido’s strong sense of design and resistance to cruft (unnecessary complexity). The language has only two looping constructs for example, based on keywords while and for. Coders extend the built-in type system using the keyword class to define new types.

“Computer Programming for Everybody” (CP4E) was Guido’s rallying cry, later the title of his successful DARPA proposal, but he wasn’t reinventing BASIC. Python would be architected from the ground up to be object oriented and state of the art.

 class Snake:
     """
     Defining a type: a snake with a name and stomach
     """

     def __init__(self, name):
         self.name = name
         self.stomach = [ ] # empty at birth
 
     def eat(self, food):
         self.stomach.append(food)

     # any_snake("🐹") synonymous with any_snake.eat("🐹")
     def __call__(self, food):
         self.eat(food)

     def __repr__(self):
         return f"Snake named {self.name} at {id(self)}"

Like Java, Python would compile from source code to an interim bytecode language that would run on a virtual machine. Although strongly typed, name bindings could change at runtime, meaning no type declarations up front, making Python a (very) high level language, and therefore slower and more memory hungry than languages with tinier runtimes, such as Rust. Python includes runtime garbage collecting of no longer used objects, and dynamically allocates more memory as objects require.

More pared-down faster relatives of Python, such as Cython, come down elsewhere along the flexibility, to runtime speed, tradeoff.

Unlike in Java, free-standing function objects (outside any class) are allowed, and may be passed around as arguments, as in JavaScript.

Also unlike Java, but like C++, operator overloading (changing the meaning of arithmetic symbols) is supported.

Even the behavior of brackets and parentheses — e.g. dog[] and cat() — may be altered on a per type basis, by providing code for the corresponding “special method names” such as: __add__ for +; __mul__ for *; __getitem__ and __setitem__ for brackets; and __call__ for parentheses.

Python has about fifty of such builtin “__ribs__” (i.e. special names). Mnemonic: “a snake has lots of __ribs__” (also known as “magic methods”).

The conversation below, at the Python REPL (read evaluate print loop), or shell, makes use of the Snake type defined above. Calling the type (Snake) triggers the constructor (__init__), with Python supplying the leftmost argument (self). Once an instance is defined (e.g. naga), directly calling it (an optional feature) triggers the __call__ method, which in turn invokes the eat method.

>>> any_snake = Snake("Naga") # triggers __init__
>>> any_snake("🐹")           # triggers __call__
>>> any_snake.eat("snack")    # appends to stomach
>>> any_snake.stomach         # accessing an attribute
['🐹', 'snack']
>>> any_snake                 # triggers __repr__
Snake named Naga at 4634375632
>>> another_snake = Snake("Twila")
>>> another_snake
Snake named Twila at 4604937040

Early Success

Python never billed itself as a “teaching language” or a “beginner language” and yet ended up fitting these billings inadvertently, because it looked like “runnable pseudo-code” (clear and compact).

MIT and other top universities gradually gave it a more prominent position in their curricula, much to the dismay of purists who had grown up learning LISP, and thereby contributing to growing resentment in some corners. The early success of Python may be attributed to two factors:

  1. it rode the wave of the free and open source movement, meaning it enjoyed partaking of the most creative software development ecosystem ever devised and
  2. it ran well on Windows, itself proprietary, but ubiquitous, and likewise a platform for free open software development.

Python’s stash of third party contributed packages, for game development, cryptography, physics modeling, and bioinformatics, exploded exponentially. In Python, as in Wolfram Language (Mathematica), scientists were discovering a cross-disciplinary lingua franca they could all develop in common.

Not only did it run on Windows in a GUI-based development environment, but the very same IDE (named IDLE, a pun on Eric Idle of Monty Python fame) ran on OSX and Linux as well.

DARPA’s funding of the CP4E proposal had given Guido time to develop IDLE, a hybrid project wherein the graphical widgets came from Tk (toolkit) written in tcl (tickle) but with Python bindings via Tkinter. To this day, Python leaves it to 3rd party libraries to provide GUI bindings (wxPython, PyQT, PyGTK…) to all but Tk (Tkinter is in the Standard Library).

SQLAlchemy provided a sophisticated object relational mapper (ORM). Twisted supported all manner of TCP/IP protocols, while the WSGI standard allowed for all manner of web serving frameworks.

Numpy and Scipy, enjoying a boost from the astronomy community especially, added more significant number crunching (e.g. linear algebra) and other science-related algorithms to Python’s ecosystem.

Python became one of the “P languages” of the LAMP stack, joining PHP and Perl atop MySQL, Apache, and Linux. Many more stacks (too many to discuss here) were to follow.

The Great Leap Forward

Although already embraced by industry and ramping up as an inhouse favorite at many companies, Google especially (because of its ability to wrap C and C++ for interactive dynamic use), Guido came to realize his early draft had some ugly “warts” he should address. This entailed making some breaking changes that would make future Python source incompatible with the then-current version 2.x interpreter.

Already successful languages usually try to avoid upsetting the applecart, endangering their privileged position, but Guido, by then affectionately referred to as Benevolent Dictator for Life, announced these breaking changes would be coming with the move to Python 3.

Y2K hysteria was already in the air and somewhat in parody, in true Monty Python fashion, the Python Community touted Python 3000 as a part of the coming millennial apocalypse.

1/2 would give a floating point answer (0.5) instead of an integer one (0). Use 1//2 instead for the latter. The print keyword would now be a builtin callable function (none of the keywords are callable). More deeply under the hood, more memory-light “just in time” constructs were introduced (e.g. range and zip), and programmed classes were more tightly unified with the pre-existing type system. Unicode support was more deeply integrated.

The language became more elegant and streamlined, laying a stronger foundation for future growth. Guido’s bold plans had paid off.

With its warts now addressed, Python 3 would go on to take the world by storm. The libraries became more powerful, and the 3rd party ecosystem ballooned with free frameworks.

In truth, Python web server solutions at first suffered from the bewildering variety of options, a disorienting cornucopia, such that Ruby on Rails (Ruby is a language more like Perl) began pulling ahead as an eclipsing technology with a stronger community. Community matters.

Python’s apparent saviors were Flask and Django, two high profile web serving solutions spanning the spectrum from micro to macro framework, in terms of infrastructure provided, from minimalist / expandable to fully loaded out of the box.

Around each project, a unique community developed. For example, Django grew out of a newspaper publishing community in Lawrence, Kansas, taking deadlines and documentation seriously and attracting an international league of top developers. Django jobs proliferated. Djangocon eventually abetted EuroPython and Pycon on the annual schedule of roaming conferences.

Additional examples of “Pythonista subcultures” would be the Blender (computer generated imagery) and ESRI (geographical information systems) communities. Both products, open and closed source respectively, are animated from within (scripted) using Python.

Python Today

By 2020, WSGI (Web Server Gateway Interface) was being abetted by ASGI (Asynchronous Server Gateway Interface), taking advantage of Python’s newest feature: the ability to define event loops of asynchronous tasks (coroutines) that may be nudged forward concurrently, in place of more complicated threading patterns.

HTTP / HTTPS has been enhanced with Websockets, a newer bidirectional web-oriented protocol, which ASGI likewise supports. The Django community was at the core of this effort, to keep Python abreast these latest changes in web server and API design. Where Python really took off after around 2015 was in data science, owing to two trends:

1. Jupyter Notebook technology (oft rebranded), evolving from I-Python, itself a more developed interactive console environment than IDLE’s. Jupyter is incorporated into the popular Anaconda distribution, with DARPA funding again.

Jupyter Notebooks implement what Donald Knuth termed “literate programming” in that code cells intermix with “markdown cells” containing formatted text, graphics, hyperlinks. Other languages besides Python may run in code cells (“Jupyter” is from Julia, Python and R — early adopters). The Atlantic Monthly (April 5, 2018) predicted Jupyter Notebook technology would eventually revolutionize scientific publishing, as Notebooks encapsulate relevant runnable code in a publication-quality format.

2. the Machine Learning revolution, linked to the evolution of GPUs as generic number crunching devices, and of Python APIs to these new predictive data-fitting models. Google would introduce TensorFlow, whereas Facebook contributed the competing Pytorch. Scikit-learn provided an additional on ramp, complete with its own teaching materials.

Python was now competing with both Matlab and R, both inner sanctum graduate school tools not used to much competition.

Now seen as a “King of the Hill” in some ways, many languages would portray themselves as “the next Python” or the “Python killer” (shades of Greek mythology) as a way to gain traction and capitalize on some feelings of resentment and jealousy in light of Python’s evident success.

In the meantime, Guido encountered huge pushback gaining acceptance for a new assignment operator, the so-called walrus whiskers :=, and after achieving victory, announced that the language must be in good hands, since even as dictator he was barely able to make additional changes.

He took that as a sign of community maturity and demoted himself to exBDFL. He continued to work on the language however, and to play a mentoring role.

Notes and references