Multiprocessing
Processes each run their own interpreter with their own GIL, so they can use every processor core. The cost is that nothing is shared by default.
A complete core Python path: syntax, data types, operators, strings, control flow, collections, functions, exceptions, files, modules, the standard library, OOP, iterators, generators, decorators, internals, concurrency, regular expressions, testing, typing, performance, security, problem solving, projects, interview preparation and exams.
110 notes in 33 topics
Processes each run their own interpreter with their own GIL, so they can use every processor core. The cost is that nothing is shared by default.
Asynchronous code runs many waiting tasks in one thread. A coroutine pauses at await, the event loop runs something else, and thousands of tasks becom...
CPython allows only one thread to execute bytecode at a time. That single lock explains why threads help with waiting and never with computation.
A pattern describes a shape of text. Character classes say what, quantifiers say how many, anchors say where, and groups say which part to keep.
Seven functions cover every regex job: search, match, fullmatch, findall, finditer, sub and split. Knowing which one to reach for is most of the skill...
Cleaning, extracting, validating and transforming real text - the jobs regular expressions were made for, worked through end to end.
JSON is the standard way to move structured data between programs. Four functions cover it, and the type mapping has a few asymmetries worth knowing.
pickle stores almost any Python object exactly as it was. It is powerful, Python only, and unsafe on data you did not create yourself.
sys.argv holds what the user typed, stdout carries results, stderr carries problems, and the exit code tells the shell whether it worked.
argparse turns a description of your options into a parser, a validator and a help page. It is the standard way to give a Python script a real interfa...
A test is a small program that checks another program. unittest ships with Python, finds your tests automatically and tells you exactly what broke.
Reading the traceback, forming a hypothesis and checking it. The debugger is a tool; the method is what actually finds the bug.