Lesser known parts of Python standard library (www.trickster.dev)
from pnutzh4x0r@lemmy.ndlug.org to python@programming.dev on 05 Sep 17:52
https://lemmy.ndlug.org/post/1077523

In this article we will explore some lesser known, but interesting and useful corners of Python standard library.

To provide more powerful containers for storing data in memory Python ships a collection module …

Python has with keyword to create context manager that will auto-cleanup things within lexical scope …

To address this problem, Python ships decimal module that allows us represent decimal numbers as Python objects with operator overloading …

Likewise, we can run into problem when dealing with fractions - one third is not exactly equal to 0.333… Python ships with fractions module to represent them as Python objects with operator overloading …

The standard Python installation ships with dis module that takes Python code units (e.g. a function) and disassembles the code into a kind of pseudo-assembler …

Python statistics module provides a small toolkit of statistical algorithms for relatively simple applications where it is an overkill to use Pandas or Numpy: standard deviation, several kinds of average of numeric data, linear regression, correlation, normal distribution and others …

To make this easier Python ships a webbrowser module with simple API to make a browser show a page …

To make this less terrible Python ships zipapp module with CLI tool and Python API to package Python code into single file packages …

#python

threaded - newest