Python - Dead Batteries Included?
Written by Mike James   
Wednesday, 22 May 2019

Python is the "batteries included" language - but is it? A recent heated talk at the Python Language Summit accused Python of having leaking batteries and suddenly the core developers are considering removing things from the standard library. What is the fuss all about?

The question of where a programming language ends and packaged code begins is a difficult one. Some languages have standard libraries that aren't part of the language syntax, but they are best regarded as part of the language - you can be assured that they are available on any platform and version. Today the Python standard library is what many programmers and companies rely on.

pfsbanner

Going beyond the standard library, there is also the Python Package Index (PyPI), aka the Cheese Shop which is almost the standard software repository for Python. When you use pip to install a package, it is where the package is downloaded from.

PyPI is great, but it also illustrates the problem with the respository approach to providing the "batteries". If you need a particular feature - an HTML server say - then typing in "web server" gets you 10,000 hits. If you restrict the search to "mature" projects then you still get 122. Which one do you use? This is how projects waste time. In addition you have no way of knowing that the code is high quality, will be maintained in the future, and doesn't contain malware.

This is not to say a standard library doesn't have problems. There is an HTML server in the standard library, but it is limited to HTTP and is very basic. It isn't clear how much love and attention it gets and so it may be standard, but that might not be enough.

A talk at this year's Python Language Summit, by Twisted contributor Amber Brown, raised the heat on the problem and got Guido so annoyed he walked out during the Q & A. The conference has been covered by A. Jesse Jiryu Davis on the Python Software Foundation web site and it is his account we recommend and rely on. Basically, Brown argues, that the standard library is broken because, not only does it contain things that no longer should be in it - NTP for example, it often needs support from PyPI packages, making its existence almost pointless.

“Python's batteries are leaking,” said Brown. She thinks that some bugs in the standard library will never be fixed. And even when bugs are fixed, PyPI libraries like Twisted cannot assume they run on the latest Python, so they must preserve their bug workarounds forever.

The list of problems continued, prompting Guido to interrupt with:

 “Can you keep to one topic? I'm sorry but this is just one long winding rant. What is your point?”

A little later it seems she did get to a single point - that the standard library stifles innovation. For example, the new asyncio feature means that packages that provided asynchronous I/O will now be overlooked because that is a "standard" way of doing the job. Of course Twisted, the package Brown has done so much for, is an asynchronous I/O package.

This causes Guido to ask again:

“Amber, what is your point?” Brown said her point was to move asyncio to PyPI, along with most new feature development. “We should embrace PyPI,” she exhorted.

Van Rossum argued instead that if the Twisted team wants the ecosystem to evolve, they should stop supporting older Python versions and force users to upgrade. Brown acknowledged this point, but said half of Twisted users are still on Python 2 and it is difficult to abandon them. The debate at this point became personal for Van Rossum, and he left angrily.

All is not completely happy in Python land.

Brown's talk was on the 18th of May. On the 20th of May the Python-Dev mailing list lit up with the start of an ongoing thread about PEP 594: Removing dead batteries from the standard library. To quote:

here is the first version of my PEP 594 to deprecate
and eventually remove modules from the standard
library. The PEP started last year with talk during
the Python Language Summit 2018

It is true that it was last year that this topic came up, but it is something of a  coincidence that it restarts now. You can see a list of modules to be removed on the mailing list archive. Needless to say both sockserver and the http.server are on the list.

Personally I, in common with Guido, would like them to stay. They might not be secure, but they are very useful for trying things out. Various comments about it not being used for production servers are quite correct, but it is used in IoT applications where a simple network interface is required.

The arguments for and against particular modules (dead, half-charged, half-full?) gives you some idea how complex this issue is. It also highlights the fact that no objective method seems to be applicable to the process. One programmer' s waste of space is another's "must have feature".  Changes in the standard library would not be backward compatible and perhaps would be a bigger upheaval than the change from Python 2 to 3.

Python has won many users on the basis of it being easy to get started with. The range of features that are available "straight out  of the tin", to use a non-battery metaphor, is part of the reason that it is so easy to use. It isn't that the standard library doesn't need some attention, it does, it is that removing things from the core is a dangerous step.

It is something of a surprise that a language as successful as Python cannot find volunteers to update and improve many of the standard library modules.

python3

 

  • Mike James is the author of Programmer's Python: Everything is an Object published by I/O Press as part of the  I Programmer Library. With the subtitle "Something Completely Different" the book is for those who want to understand the deeper logic in the approach that Python 3 takes to classes and objects.

 

 

More Information

Amber Brown: Batteries Included, But They're Leaking

Related Articles

Guido van Rossum On Python and Diversity in Open Source

Guido van Rossum Quits As Python BDFL 

Python Passion For Assignment Expressions - PEP 572

New Governance Model For Python

Python Language Of The Year

Python Development Trends

What Makes Python Special?

Getting Started with Python (Book Extract)

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Raspberry Pi Beaten To It With Pico Plus 2
02/10/2024

RPi recently announced the Pico 2, but while we are all waiting for the more useful Pico 2W, with WiFi, the tiny Pimoroni outfit has produced something better - the Pico Plus 2 with WiFi. What is goin [ ... ]



Valkey's Expanding Ecosystem
10/10/2024

Valkey, heralded as a better alternative to Redis, has taken the industry by storm. Reinforcing its superiority, a rapidly growing ecosystem is being built around it.


More News

kotlin book

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962587>

<ASIN:B07S1K8KLW>

Last Updated ( Wednesday, 22 May 2019 )