Index
A
- absolute imports
- about / Absolute imports
- abstract base classes (ABCs)
- about / Abstract base classes
- using / Using an abstract base class
- creating / Creating an abstract base class
- @classmethod / Demystifying the magic
- abstract factory pattern
- about / The abstract factory pattern
- abstraction
- about / Hiding details and creating the public interface
- examples / Hiding details and creating the public interface
- defining / Inheritance provides abstraction
- abstract methods
- about / Inheritance
- access control
- about / Who can access my data?
- adapter pattern
- about / The adapter pattern
- Interface1 / The adapter pattern
- Interface2 / The adapter pattern
- Adapter class / The adapter pattern
- aggregation
- about / Composition
- and composition, comparing / Composition
- arguments
- about / Behaviors are actions
- assertion methods
- about / Assertion methods
- AsyncIO
- about / AsyncIO
- implementing / AsyncIO in action
- future, reading / Reading an AsyncIO future
- for networking / AsyncIO for networking
- executors, using to wrap blocking code / Using executors to wrap blocking code
- streams / Streams
- executors / Executors
- attribute
- about / Data describes objects
- attributes
- specifying / Specifying attributes and behaviors
B
- basic inheritance
- about / Basic inheritance
- built-ins, extending / Extending built-ins
- overriding / Overriding and super
- super function / Overriding and super
- behaviors
- about / Introducing object-oriented
- specifying / Specifying attributes and behaviors
- defining / Behaviors are actions
- bottom-up design / Exercises
- built-ins
- extending / Extending built-ins
C
- CamelCase notation / Creating Python classes
- case study, object-oriented design
- about / Case study
- character classes / Matching a selection of characters
- class
- about / Objects and classes
- classes
- defining / Objects and classes
- code coverage
- about / How much testing is enough?
- code coverage test
- verifying / How much testing is enough?
- command pattern
- about / The command pattern
- composite pattern
- about / The composite pattern
- composition
- about / Composition
- comprehensions
- list comprehensions / List comprehensions
- dictionary comprehension / Set and dictionary comprehensions
- generator expressions / Generator expressions
- concurrency
- case study / Case study
- constructor / Initializing the object
- context manager
- about / Placing it in context
- coroutines
- about / Coroutines
- log parsing / Back to log parsing
- closing / Closing coroutines and throwing exceptions
- exception, raising / Closing coroutines and throwing exceptions
- relationship, with generators / The relationship between coroutines, generators, and functions
- relationship, with functions / The relationship between coroutines, generators, and functions
- Counter object / Counter
- coverage.py / How much testing is enough?
D
- data
- about / Introducing object-oriented
- defining / Data describes objects
- objects, defining / Data describes objects
- data notation / Serializing web objects
- decorator pattern
- about / The decorator pattern
- uses / The decorator pattern
- Core / The decorator pattern
- Interface / The decorator pattern
- example / A decorator example
- using, in Python / Decorators in Python
- decorators
- about / Decorators – another way to create properties
- design patterns
- about / Design patterns in brief
- decorator pattern / The decorator pattern
- observer pattern / The observer pattern
- strategy pattern / The strategy pattern
- state pattern / The state pattern
- singleton pattern / The singleton pattern
- template pattern / The template pattern
- adapter pattern / The adapter pattern
- facade pattern / The facade pattern
- flyweight pattern / The flyweight pattern
- command pattern / The command pattern
- abstract factory pattern / The abstract factory pattern
- composite pattern / The composite pattern
- Dewey Decimal System (DDS)
- about / Case study
- dictionaries
- about / Dictionaries
- use cases / Dictionary use cases
- defaultdict, using / Using defaultdict
- Counter object / Counter
- dictionary comprehension
- about / Set and dictionary comprehensions
- docstrings
- about / Explaining yourself
- using / Explaining yourself
- dot notation / Adding attributes
- duck typing
- about / Inheritance provides abstraction
E
- empty objects
- about / Empty objects
- encapsulation
- about / Hiding details and creating the public interface
- exceptions
- raising / Raising exceptions, Raising an exception
- effects / The effects of an exception
- handling / Handling exceptions
- hierarchy / The exception hierarchy
- custom exceptions, defining / Defining our own exceptions
- case study / Case study
- expensive objects
- imitating / Imitating expensive objects
F
- facade pattern
- about / The facade pattern
- FIFO (First In First Out) queues
- about / FIFO queues
- file I/O
- about / File I/O
- flyweight pattern
- about / The flyweight pattern
- funcargs / A completely different way to set up variables
- functions
- about / Functions are objects too
- using, as attributes / Using functions as attributes
- callable objects / Callable objects
- futures
- about / Futures
G
- generators
- about / Generators
- data, yielding from another iterable / Yield items from another iterable
- global interpreter lock (GIL) / The global interpreter lock
H
- hashable / Dictionaries
I
- information hiding
- defining / Hiding details and creating the public interface
- about / Hiding details and creating the public interface
- inheritance
- about / Composition, Inheritance
- case study / Case study
- instance diagram
- about / Composition
- interfaces
- about / Inheritance
- International Standard Book Number (ISBN)
- about / Case study
- iterator pattern
- case study / Case study
- iterators
- about / Iterators
- iterator protocol / The iterator protocol
J
- JavaScript Object Notation (JSON) / Serializing web objects
L
- LIFO (Last In First Out) queues
- about / LIFO queues
- list comprehensions
- about / List comprehensions
- lists
- about / Lists
- sorting / Sorting lists
M
- mailing list manager, case study
- building / Case study
- members
- about / Data describes objects
- method overloading
- about / An alternative to method overloading
- default arguments / Default arguments
- variable argument lists / Variable argument lists
- unpacking arguments / Unpacking arguments
- methods
- about / Behaviors are actions
- module contents
- organizing / Organizing module contents
- modules
- about / Modules and packages
- example / Modules and packages
- organizing / Organizing the modules
- absolute imports / Absolute imports
- relative imports / Relative imports
- multiple inheritance
- about / Multiple inheritance, Multiple inheritance
- diamond problem / The diamond problem
- sets of arguments / Different sets of arguments
- multiprocessing
- about / Multiprocessing
- pools / Multiprocessing pools
- queues / Queues
- drawbacks / The problems with multiprocessing
- mutable byte strings
- about / Mutable byte strings
O
- object
- and class, comparing / Objects and classes
- object-oriented
- defining / Introducing object-oriented
- Object-oriented analysis (OOA)
- about / Introducing object-oriented
- object-oriented design
- analysis problems / Exercises
- Object-oriented design (OOD)
- about / Introducing object-oriented
- object-oriented programming
- examples / Inheritance
- case study / Case study
- Object-oriented programming (OOP)
- about / Introducing object-oriented
- object diagram
- about / Composition
- objects
- defining / Objects and classes
- about / Treat objects as objects
- identifying / Treat objects as objects
- managing / Manager objects
- duplicate code, removing / Removing duplicate code
- existing code, reusing / In practice
- serializing / Serializing objects
- pickles, customizing / Customizing pickles
- web objects, serializing / Serializing web objects
- observer pattern
- about / The observer pattern
- example / An observer example
P
- package
- about / Organizing the modules
- parameters
- about / Behaviors are actions
- patterns matching, regular expression
- about / Matching patterns
- selection of characters, matching / Matching a selection of characters
- characters, escaping / Escaping characters
- multiple characters, matching / Matching multiple characters
- patterns, grouping / Grouping patterns together
- PEP 3101
- URL / Making it look right
- pick action
- about / Behaviors are actions
- pitfalls, threads
- about / The many problems with threads
- shared memory / Shared memory
- global interpreter lock / The global interpreter lock
- polymorphism
- about / Inheritance provides abstraction, Polymorphism
- priority queue
- about / Priority queues
- properties
- about / Data describes objects
- using, for adding behavior to class data / Adding behavior to class data with properties
- using / Deciding when to use properties
- property constructor / Properties in detail
- property function / Properties in detail
- public interface
- creating / Hiding details and creating the public interface
- py.test
- about / Testing with py.test
- testing with / Testing with py.test
- setup / One way to do setup and cleanup
- cleanup / One way to do setup and cleanup
- variables, setting up / A completely different way to set up variables
- tests, skipping with / Skipping tests with py.test
- Python
- about / Explaining yourself
- Python built-in functions
- about / Python built-in functions
- len() function / The len() function
- reversed() function / Reversed
- enumerate function / Enumerate
- Python classes
- creating / Creating Python classes
- attributes, adding / Adding attributes
- implementing / Making it do something
- arguments / More arguments
- object, initializing / Initializing the object
- Python data structures
- empty objects / Empty objects
- tuples / Tuples and named tuples
- named tuples / Named tuples
- dictionaries / Dictionaries
- lists / Lists
- sets / Sets
- built-ins, extending / Extending built-ins
- queues / Queues
- case study / Case study
Q
- queues
- about / Queues
- FIFO queues / FIFO queues
- LIFO queues / LIFO queues
- priority queues / Priority queues
R
- regular expressions
- about / Regular expressions
- patterns, matching / Matching patterns
- information, obtaining from / Getting information from regular expressions
- repeated regular expressions, making efficient / Making repeated regular expressions efficient
- case study / Case study
- relative imports
- about / Relative imports
S
- self argument / Talking to yourself
- sequence diagram
- about / Case study
- sets
- about / Sets
- simple command-line notebook application
- building / Case study
- singleton pattern
- about / The singleton pattern
- implementing / Singleton implementation
- slots
- about / Empty objects
- stacks / LIFO queues
- state pattern
- about / The state pattern
- example / A state example
- versus, strategy pattern / State versus strategy
- state transition as coroutines / State transition as coroutines
- strategy pattern
- about / The strategy pattern
- User code / The strategy pattern
- Abstraction interface / The strategy pattern
- example / A strategy example
- using, in Python / Strategy in Python
- string formatting
- about / String formatting
- braces, escaping / Escaping braces
- keyword arguments / Keyword arguments
- container lookups / Container lookups
- object lookups / Object lookups
- string manipulation
- about / String manipulation
- strings
- about / Strings, Strings are Unicode
- bytes, converting to text / Converting bytes to text
- text, converting to bytes / Converting text to bytes
- mutable byte strings / Mutable byte strings
- SyntaxError / Initializing the object
T
- template pattern
- about / The template pattern
- example / A template example
- test
- need for / Why test?
- test-driven development
- about / Test-driven development
- case study / Case study, Implementing it
- third-party libraries
- about / Third-party libraries
- threads
- about / Threads
- pitfalls / The many problems with threads
- thread overhead / Thread overhead
- top-down design / Exercises
- tuples
- about / Tuples and named tuples
- named tuples / Named tuples
U
- UDP (User Datagram Protocol) / AsyncIO for networking
- UML sequence diagram
- about / Case study
- Unified Modeling Language (UML)
- about / Objects and classes
- example / Objects and classes
- unit tests
- about / Unit testing
- assertion methods / Assertion methods
- boilerplate, reducing / Reducing boilerplate and cleaning up
- organizing / Organizing and running tests
- running / Organizing and running tests
- broken tests, ignoring / Ignoring broken tests
V
- value / Dictionaries
- values
- about / Behaviors are actions
W
- web objects
- serializing / Serializing web objects