Python’s simplicity lets you become productive quickly, but this often means you aren’t using everything it has to offer. With this hands-on guide, you’ll learn how to write effective, idiomatic Python code by leveraging its best—and possibly most neglected—features. Author Luciano Ramalho takes you through Python’s core language features and libraries, and shows you how to make your code shorter, faster, and more readable at the same time.
Many experienced programmers try to bend Python to fit patterns they learned from other languages, and never discover Python features outside of their experience. With this book, those Python programmers will thoroughly learn how to become proficient in Python 3.
This book covers:
Python data model: understand how special methods are the key to the consistent behavior of objects
Data structures: take full advantage of built-in types, and understand the text vs bytes duality in the Unicode age
Functions as objects: view Python functions as first-class objects, and understand how this affects popular design patterns
Object-oriented idioms: build classes by learning about references, mutability, interfaces, operator overloading, and multiple inheritance
Control flow: leverage context managers, generators, coroutines, and concurrency with the concurrent.futures and asyncio packages
Metaprogramming: understand how properties, attribute descriptors, class decorators, and metaclasses work
Table of Contents
Part I. Prologue
Chapter 1. The Python Data Model
Part II. Data structures
Chapter 2. An array of sequences
Chapter 3. Dictionaries and sets
Chapter 4. Text versus bytes
Part III. Functions as objects
Chapter 5. First-class functions
Chapter 6. Design patterns with first-class functions
Chapter 7. Function decorators and closures
Part IV. Object Oriented Idioms
Chapter 8. Object references, mutability and recycling
Chapter 9. A Pythonic object
Chapter 10. Sequence hacking, hashing and slicing
Chapter 11. Interfaces: from protocols to ABCs
Chapter 12. Inheritance: for good or for worse
Chapter 13. Operator overloading: doing it right
Part V. Control flow
Chapter 14. Iterables, iterators and generators
Chapter 15. Context managers and else blocks
Chapter 16. Coroutines
Chapter 17. Concurrency with futures
Chapter 18. Concurrency with asyncio
Part VI. Metaprogramming
Chapter 19. Dynamic attributes and properties
Chapter 20. Attribute descriptors
Chapter 21. Class metaprogramming
Comments need intelligible text (not only emojis or meaningless drivel). No upload requests, visit the forum or message the uploader for this. Use common sense and try to stay on topic.