133 Practical Recipes for Modern Python 💻
Modern Python Cookbook, Second Edition is a task-focused guide to writing clear, idiomatic Python 3.8. Steven F. Lott presents 133 recipes that address everyday programming problems, from choosing the right numeric type to structuring larger applications with classes, functional tools, and reliable tests.
Rather than treating Python as a list of syntax rules, the book shows how experienced developers make design choices. Each recipe states a problem, outlines a solution, and explains why the approach works—so you can adapt the pattern to your own code instead of copying it blindly.
What the Recipes Cover ðŸ§
- Numbers, strings, and tuples: large integers, decimal vs. float, floor division, f-strings, Unicode, and NamedTuples.
- Statements and syntax: script structure, long lines, RST docstrings, walrus operator, exception matching, and context managers.
- Functions: type hints, optional parameters, keyword-only arguments, positional-only parameters, partials, and recursion.
- Data structures: lists, sets, dictionaries, slicing, comprehensions, shallow vs. deep copies, and type hints for collections.
- Classes and objects: encapsulation, dataclasses, frozen dataclasses, __slots__, properties, inheritance, composition, and duck typing.
- Functional programming: generators, transformations, filters, reductions, partial functions, and immutable data structures.
- Input/output: pathlib, CSV, JSON, YAML, XML, HTML, and logical record layouts.
- Testing: doctest, unittest, pytest, and combining test tools for more reliable code.
Built for Python 3.8
This second edition has been updated for Python 3.8, including newer language features such as the walrus operator, positional-only parameters, and improved typing patterns. The recipes remain practical and focused, but the code reflects the Python that many teams use today.
Who This Book Is For
Modern Python Cookbook is aimed at developers who already know the basics of Python and want to write more expressive, maintainable code. It is especially useful if you work with Python regularly and want a reference you can revisit when a specific design question comes up—whether you are cleaning data, designing a class, writing tests, or improving an older script.
Why a Recipe Format Works
Programming problems rarely arrive in textbook order. The recipe format lets you jump to the topic you need, read a focused explanation, and return to your project with a concrete approach. The book works as both a cover-to-cover study of modern Python practice and a reference for the moments when you want a second opinion on structure, style, or standard-library tools.
Inside the Second Edition
Across its chapters, the book moves from core data handling into functions, object-oriented design, functional techniques, file formats, and testing. The result is a broad but connected view of Python development, with each recipe adding another tool to your everyday toolkit.
Add Modern Python Cookbook, Second Edition to your digital library and keep a practical Python reference close at hand.
User Reviews
Only logged in customers who have purchased this product may leave a review.
Functional Python Programming: Use a Functional Approach to Write Succinct, Expressive, and Efficient Python Code (Third Edition)
Sold by Steven F. Lott
Python Object-Oriented Programming
Sold by Steven F. Lott
Original price was: $5.00.$2.50Current price is: $2.50.

There are no reviews yet.