Book Announcement:

https://www.packtpub.com/en-us/product/modern-python-cookbook-9781835466384

There are about 130 recipes in here. Some new. Some revised. All examined (and tested) for Python 3.12.

For the Python folks who are just starting as well as those looking to pick up some more skills, this is for you

The recipes cover a wide variety of topics. It covers both functional and object-oriented programming.

Here's a run-down of the chapters (yes, it's a long list):

  1. Numbers, Strings, and Tuples
  2. Statements and Syntax
  3. Function Definitions
  4. Built-In Data Structures Part 1: Lists and Sets
  5. Built-In Data Structures Part 2: Dictionaries
  6. User Inputs and Outputs
  7. Basics of Classes and Objects
  8. More Advanced Class Design
  9. Functional Programming Features
  10. Working with Type Matching and Annotations
  11. Input/Output, Physical Format, and Logical Layout
  12. Graphics and Visualization with Jupyter Lab
  13. Application Integration: Configuration
  14. Application Integration: Combination
  15. Testing
  16. Dependencies and Virtual Environments
  17. Documentation and Style

Most chapters have recipes that include beginners as well as advanced developers. For example, the first chapter covers the differences between true division and floor division. Some folks get this deeply, where for others, it can feel cryptic at first.

Some chapters are based on others, making them less beginner-oriented. The Functional Programming Features chapter is based on the Function Definitions chapter. The More Advanced Class Design chapter builds on the Basics of Classes and Objects chapter.

Since the whole book is tested (both doctests and unit tests), I'm particularly fond of the Testing chapter. I have read posts from too many folks saying that testing isn't a thing in school, and at work, they're left on their own to work out what and how to test. I think I can help a little with some recipes on using docstrings, testing functions with exeptions, using unittest, using pytest, and mocking external resources.

I’m hoping you’ll find this useful for growing a deeper understanding of Python programming.