Python (programming language): Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Johan Förberg
(→‎History: Updated the very old version information. See talk page.)
mNo edit summary
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{subpages}}
{{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]].


'''Python''' is a dynamic object-oriented, general purpose [[Programming_language#Compiled_vs._interpreted|interpreted programming language]] which runs on many different computer platforms and mobile devices. Python is [[open source software]]. 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.
==Origins==


==History==
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 was first published by the Dutch computer scientist (and applied mathematician) Guido van Rossum in pre-release (early-adopter) form in 1991, and to this day he remains the project leader and final arbiter of Python Enhancement Proposals (PEPs).


Python 2.7.1 is the current production release, and is very stable.
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).


Python's major (standard) releases were:
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.
* Python 2.5.1 (April 2007)
* Python 2.4.4 (October 2006)
* Python 2.3.6 (November 2006)
* Python 2.2.3 (May 2003)
* Python 2.1.3 (April 2002)
* Python 2.0.1 (June 2001)
* Python 1.6.1 (September 2000)
* Python 1.5.2 (April 1999)
* Python 1.4 (October 1996)
* Python 1.3 (October 1995)
* Python 1.2 (April 1995)
* Python 1.1 (1995)
* Python 1.0 (1994)


==Examples==
“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.


===Hello World===
  class Snake:
The code for the "hello world" program can hardly be more simple:
      """
      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> print 'Hello World'</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.


This can be put in a file "hello.py", for example, and executed with
More pared-down faster relatives of Python, such as Cython, come down elsewhere along the flexibility, to runtime speed, tradeoff.


<code> python hello.py </code>
Unlike in Java, free-standing function objects (outside any class) are allowed, and may be passed around as arguments, as in JavaScript.


from your operating system's command line. Alternatively, the code can be typed directly into an interactive Python environment (the Python command line interpreter or [[IDLE (Python programming language)|IDLE]], both of which are included in the standard Python distribution).
Also unlike Java, but like C++, operator overloading (changing the meaning of arithmetic symbols) is supported.


===Calculator===
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.
The Python interpreter can be invoked from the command line and used as a scientific calculator. At the prompt (denoted here by <code> >>> </code>), type


<code> >>> 2+3*(1+1)</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”).


the interpreter will print 8. Division of integers returns an integer result, so
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/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


is 3 ([[floor]] from the exact result). If a [[real number|real]] result is needed, then at least one [[operand]] should be a real number, as shown below
==Early Success==


<code> >>> 7.0/2</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).


More interesting functions can be found in the <tt>math</tt> ''module''. It must be imported before it can be used.
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:


<code> >>> from math import *</code>
# 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
<br>
# it ran well on Windows, itself proprietary, but ubiquitous, and likewise a platform for free open software development.
<code> >>> print sin(pi/2)</code>


High quality graphs may be obtained with the <tt>matplotlib</tt> library<ref>This is installed separately, see its [http://matplotlib.sourceforge.net/tutorial.html introduction] and a couple of [http://matplotlib.sourceforge.net/screenshots.html examples].</ref>
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.


===Files===
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.
A useful Python construction is related to working with files. Line-by-line Perl-like file processing can be realized with a standard <code>for</code> loop as in the following simple word count script. Below, the comments start with the hash '#' sign.
<pre>
(char_count,word_count,line_count)=0,0,0      # multiple assignment is available
file = open ('myfile.txt')                    # standard opening of the file
for line in file:                            # this is "idiomatic" use of of the "for" loop
    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>


The indentation indicates what code is executed within the loop. This is part of Python's 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.
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).


===Internet access===
[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.


The following script counts the images on the Citizendium [[Main Page]].
[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.
<pre>
1  import urllib2                     
2  cnt=0
3  for line in urllib2.urlopen('http://en.citizendium.org/wiki/Main_Page'):
4      cnt += line.count('<img src')
5  print cnt
</pre> (note that the line numbers were added for clarity - they are not needed in an actual Python script)


*In line 1, we import a module from the standard library. Python's standard library is said to be rich and often regarded as Python's strong point. In fact, Python official pages declare a "batteries included" philosophy.  
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.


*In line 2, the variable named 'cnt' is set to zero initially (a best practice in programming)
==The Great Leap Forward==


*In line 3, the [[URL]] is fetched using the urllib2 function. This merits some discussion. In Python, 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.  
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.


*In line 4 (inside the for loop), the appropriate method <tt>count()</tt> is used to increment the cnt variable by one every time the [[HTML]] tag beginning with "<img src" is encountered.
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.


*In line 5, after the for loop exits (presumably because all instances of the 'img' tag have been counted), the variable 'cnt' is printed.
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.


A ready-to-run copy of this script is available [[Python_programming_language/GetURL.py|here]].
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.


==Syntax==
The language became more elegant and streamlined, laying a stronger foundation for future growth. Guido’s bold plans had paid off.
Remarkable global features of the Python syntax include high readability of the code, which is aided by 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==
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.
Python's official distribution is known as CPython. It's written in [[C_programming_language|C]] and functions as a virtual machine for 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.


==Run-time efficiency==
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.
Generally, a high-level interpreted scripting language is far not as fast as a compiled program. However, a specializing just-in-time compiler "Psyco"<ref>[http://psyco.sourceforge.net/ Psyco: High-level languages need not be slower than low-level ones.]</ref> runs existing Python programs much faster, with no change in the source text. In addition, the Python library contains a number of modules performing useful operations quite effectively. For example, "anydbm"<ref>[http://docs.python.org/release/2.5.2/lib/module-anydbm.html anydbm -- Generic access to DBM-style databases]</ref> can effectively maintain a large indexed file.


==Python IDEs==
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.


Python can be supported as the programming language in an [[integrated development environment]] (IDE).
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.


Popular Python IDEs include the following:
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.


* [[IDLE (Python programming language)|IDLE]], the default Integrated Development Environment for Python
==Python Today==
* [http://pydev.sourceforge.net/ Eclipse pydev], the pydev plug-in to the Eclipse IDE for Python
* [http://www.activestate.com/products/komodo_ide/ ActiveState Komodo], the multiple scripting languages IDE
* [http://www.wingware.com/products Wingware Wing], the multiplatform Python-language-specific IDE


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]]

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