The Python Master (75% Complete)

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Mastery of the Python calls for felicity with the full depth and breadth of the language. We'll go all the way in this book to show you how to use the most powerful of Python's language features to greatest effect...with occasional reminders that sometimes there is a simpler way.

Author(s): Robert Smallshire, Austin Bingham
Publisher: Leanpub
Year: 2019

Language: English
Pages: 187
Tags: python

Conventions Used in This Book......Page 6
Welcome!......Page 9
Experience with concepts from the previous books......Page 11
The Road Goes On Forever......Page 12
else clauses on loops......Page 13
An alternative to loop else clauses......Page 22
The try..except..else construct......Page 23
Emulating switch......Page 24
Dispatching on Type......Page 30
Summary......Page 37
Bitwise operators......Page 40
The bytes type in depth......Page 47
The mutable bytearray sequence......Page 49
Interpreting byte streams with the struct module......Page 50
Memory Views......Page 61
Memory-mapped files......Page 68
Summary......Page 71
How are Python objects stored?......Page 73
Using vars() to access __dict__......Page 85
Overriding __getattribute__()......Page 86
Special methods which bypass __getattribute__()......Page 89
Where are the methods?......Page 91
Slots......Page 92
Summary......Page 95
A review of properties......Page 96
Unravelling the property function......Page 99
Implementing a descriptor......Page 102
Retrieving descriptors on classes......Page 108
Data versus non-data descriptors......Page 109
Summary......Page 111
Instance Creation......Page 113
Customising allocation......Page 117
Summary......Page 120
The class of class objects......Page 122
Class allocation and initialisation......Page 124
Passing additional arguments to the metaclass......Page 129
Metaclass methods and visibility......Page 132
Fine-grained instantiation control with metaclass __call__()......Page 134
Practical metaclass examples......Page 138
Metaclasses and Inheritance......Page 145
Summary......Page 149
A first class decorator......Page 151
Enforcing constraints with a class decorator......Page 152
Enforcing constraints for properties......Page 155
Chaining class decorators......Page 158
Summary......Page 160
What is an abstract base-class?......Page 162
Why are abstract base-classes useful?......Page 163
Abstract base-classes in Python......Page 164
Defining subclasses with __subclasscheck__()......Page 165
Non-transitivity of subclass relationships......Page 169
Library support for abstract base-classes......Page 170
Propagating abstractness through descriptors......Page 177
Fixing our @invariant class decorator with ABCs......Page 179
Summary......Page 183
Afterword: Continue the journey......Page 185
Notes......Page 186