As promised, here starts the ill-advised series of me reading the #Python Standard Library documentation. First day: Built-In Functions, which I grouped by topic.

My personal highlight was learning about the two-argument version of iter():

November 30: Built-in types (and constants and exceptions). Highlights include my surprise at set operations taking any iterable when you spell them out (my_set.union([1,2,3]) works!)

December 1: Text processing services, with the modules: string, re, difflib, textwrap, unicodedata, stringprep, readline.

Highlights: Some string functions I didn't know about, a reminder that textwrap exists and is good, and difflib.get_close_matches()

December 2: Binary data services, namely struct and codecs. Not a lot this time, but that's only fair, because tomorrow is "data types" 😱

Highlights for today: Yet Another Format String Syntax, and also native support for ROT-13 let's go

December 3: The "data types" section, which was … a lot: datetime, calendar, collections, heapq, bisect, array, weakref, types, copy, pprint, reprlib and enum.

tl;dr: collections remains the best, enums are weird, and I have a decent grip on weakrefs now

With a full 13 minutes to go until midnight! December 4: maths.

Highlights include shameless tau propaganda, giggling at the reason that cmath exists, fraction.limit_denominator() 😍, and my eyes glazing over at the amount of statistics Python can do.

Proceeding: Python Functional Programming Modules, itertools and functools and operator (yes, the one you only ever use for sorting by a specific key).

Big learning day: I learnt about cached_property and lru_cache and singledispatch.

More than a week in, I'm switching to AoE submission mode 🤣

Today: File access modules, or: oh god, why are there SO MANY. Highlights include some neat shutil functions and also the huge comparison table for the os.path/pathlib overlap.

I published the blog post yesterday, but forgot to post here: Python Data Persistence Modules (aka: pickle and some even weirder stuff).

Next: Python data compression modules. Python has a CLI interface for compressing, listing and decompressing zip and tar archives, who knew!

TIL in Python: CSV, JSON and XML all live in different sections of the Python docs. Also, there are dataformats like netrc, xdr and plist. Also, use csv.DictReader/Writer!

And INI files can support variable expansion, what could possibly go wrong.

🤫 secrets! And other cryptographic service modules. Not a lot to say here, really, except that the secrets module exists and should be use for security-critical randomness.

I'm a day late, because this entry is about "operating system services", and that includes os, io, time, argparse, getopt, logging and its submodules, getpass, curses and submodules, platform, errno and ctypes. Whew.

Back on track thanks to the shortest section in the documentation tree: It's just context variables. It's a bit terse, so instead of my usual summary post, this is me trying to make sense of the whole thing.

I had to take a break for real life reasons, which came knocking and were not to be denied. Oops.

Aaanyway, I'm back and playing catch-up. This one's about concurrency, including threading, multiprocessing, concurrent, subprocess, sched and queue. Yes. Ouch.

Also included: The documentation LIED to me (or did not predict my hilariousness, at least).

Melde dich an, um an der Konversation teilzuhaben

Mastodon ist ein soziales Netzwerk. Es basiert auf offenen Web-Protokollen und freier, quelloffener Software. Es ist dezentral (so wie E-Mail!).