M

Mac OS X platform, GUIs, Introducing the Python Interpreter, Frozen Binaries, Starting an Interactive Session, Where to Run: Code Directories, Icon-Click Basics, IDLE Startup Details, Still Other Launch Options
frozen binaries and, Frozen Binaries
GUI support, GUIs
icon clicks, Icon-Click Basics
IDLE startup details, IDLE Startup Details
installing Python, Introducing the Python Interpreter
launch options, Still Other Launch Options
system shell prompt, Starting an Interactive Session
working directory, Where to Run: Code Directories
macros, decorators versus, Why Decorators?
__main__ module, Mixed Usage Modes: __name__ and __main__Unit Tests with __name__, Exploring Shelves Interactively
manager functions, Decorators Versus Manager Functions, The Downside of “Helper” FunctionsThe Downside of “Helper” Functions
map built-in function, Comprehensions, List Iteration and Comprehensions, Loop Coding Techniques, Parallel Traversals: zip and mapDictionary construction with zip, Parallel Traversals: zip and mapDictionary construction with zip, map equivalence in Python 2.X, Other Iteration Contexts, New Iterables in Python 3.X, The map, zip, and filter Iterables, Mapping Functions over Iterables: mapMapping Functions over Iterables: map, List Comprehensions Versus map, On the other hand: performance, conciseness, expressiveness, Generator expressions versus mapGenerator expressions versus map, Example: Emulating zip and map with Iteration ToolsCoding your own zip(...) and map(None, ...), Timing ResultsThe impact of function calls: map, A win for map and a rare loss for PyPy, Timing Calls
benchmarking, A win for map and a rare loss for PyPy
generator expressions versus, Generator expressions versus mapGenerator expressions versus map
homegrown timing module and, Timing ResultsThe impact of function calls: map
iteration and, Other Iteration Contexts, New Iterables in Python 3.X, The map, zip, and filter Iterables, Mapping Functions over Iterables: mapMapping Functions over Iterables: map, Example: Emulating zip and map with Iteration ToolsCoding your own zip(...) and map(None, ...)
list comprehensions versus, Comprehensions, List Iteration and Comprehensions, List Comprehensions Versus map, On the other hand: performance, conciseness, expressiveness
loop coding techniques and, Loop Coding Techniques, Parallel Traversals: zip and mapDictionary construction with zip
parallel traversals, Parallel Traversals: zip and mapDictionary construction with zip
timing calls example, Timing Calls
version considerations, map equivalence in Python 2.X
mapattrs module, Room for improvement: MRO, slots, GUIs
mapping operations, Dictionaries, Mapping Operations, Missing Keys: if TestsMissing Keys: if Tests, Missing Keys: if TestsMissing Keys: if Tests, Preview: Mapping values to keys, Preview: Mapping values to keys, Mapping Functions over Iterables: mapMapping Functions over Iterables: map, Example: Mapping Attributes to Inheritance SourcesExample: Mapping Attributes to Inheritance Sources
about, Dictionaries
dictionaries and, Mapping Operations, Missing Keys: if TestsMissing Keys: if Tests, Preview: Mapping values to keys
functions and, Mapping Functions over Iterables: mapMapping Functions over Iterables: map
mapping attributes to inheritance sources, Example: Mapping Attributes to Inheritance SourcesExample: Mapping Attributes to Inheritance Sources
mapping values to keys, Preview: Mapping values to keys
missing keys, Missing Keys: if TestsMissing Keys: if Tests
math module, Numbers, Floor versus truncation, Floor versus truncation, Other Built-in Numeric Tools
about, Numbers
built-in numeric tools, Other Built-in Numeric Tools
floor function, Floor versus truncation
trunc function, Floor versus truncation
mathematical operations, Numbers, Numbers, Python Expression Operators, Division: Classic, Floor, and TrueWhy does truncation matter?
about, Numbers
division, Division: Classic, Floor, and TrueWhy does truncation matter?
expression operators, Python Expression Operators
nesting, Numbers
Matlab numeric programming system, Why Do People Use Python?, Nesting
matrixes, Indexing, Slicing, and Matrixes, Example: List Comprehensions and MatrixesExample: List Comprehensions and Matrixes
list comprehensions and, Example: List Comprehensions and MatrixesExample: List Comprehensions and Matrixes
nested lists and, Indexing, Slicing, and Matrixes
max built-in function, Other Built-in Numeric Tools, Other Iteration Contexts
membership, Missing Keys: if Tests, Other Core Types, Other Common String Methods in Action, Basic Dictionary Operations, Membership: __contains__, __iter__, and __getitem__Membership: __contains__, __iter__, and __getitem__
in operator and, Missing Keys: if Tests, Other Core Types, Other Common String Methods in Action, Basic Dictionary Operations
operator overloading and, Membership: __contains__, __iter__, and __getitem__Membership: __contains__, __iter__, and __getitem__
memory management, It’s Powerful, Nesting Revisited, Objects Are Garbage-Collected, Changing Strings I, Why generator expressions?, How Python Stores Strings in Memory
automatic, It’s Powerful
garbage collection, Nesting Revisited, Objects Are Garbage-Collected, Changing Strings I
generator expressions and, Why generator expressions?
storing strings, How Python Stores Strings in Memory
metaclasses, Attribute Tree Construction, Why the lookup change?, Decorators and Metaclasses: Part 1, A First Look at Class Decorators and MetaclassesA First Look at Class Decorators and Metaclasses, Metaclasses, To Metaclass or Not to MetaclassMetaclasses Versus Class Decorators: Round 1, Metaclasses Versus Class Decorators: Round 1Metaclasses Versus Class Decorators: Round 1, The Metaclass ModelClass Statement Protocol, Metaclasses Are Subclasses of Type, Class Statement Protocol, Declaring MetaclassesMetaclass Dispatch in Both 3.X and 2.X, Declaration in 3.XMetaclass Dispatch in Both 3.X and 2.X, Coding MetaclassesOverloading class creation calls with metaclasses, Customizing Construction and Initialization, Using simple factory functions, Overloading class creation calls with normal classesOverloading class creation calls with metaclasses, Inheritance and InstanceThe built-ins special case, Inheritance and InstanceThe built-ins special case, Metaclass Versus Superclass, The descriptors special case, The built-ins special caseThe built-ins special case, Metaclass MethodsMetaclasses Versus Class Decorators: Round 3 (and Last), Operator Overloading in Metaclass Methods, Example: Adding Methods to ClassesMetaclasses Versus Class Decorators: Round 3 (and Last), Metaclasses Versus Class Decorators: Round 2Metaclass and class decorator equivalence?, Managing instances instead of classesManaging instances instead of classes, Metaclasses Versus Class Decorators: Round 3 (and Last)Metaclasses Versus Class Decorators: Round 3 (and Last)
about, Metaclasses
built-in object types and, The built-ins special caseThe built-ins special case
call pattern issues and, Why the lookup change?
class decorators and, Decorators and Metaclasses: Part 1, A First Look at Class Decorators and MetaclassesA First Look at Class Decorators and Metaclasses, Metaclasses Versus Class Decorators: Round 1Metaclasses Versus Class Decorators: Round 1, Metaclasses Versus Class Decorators: Round 2Metaclass and class decorator equivalence?, Metaclasses Versus Class Decorators: Round 3 (and Last)Metaclasses Versus Class Decorators: Round 3 (and Last)
class statement and, Class Statement Protocol
coding, Coding MetaclassesOverloading class creation calls with metaclasses
customizing construction and initialization, Customizing Construction and Initialization
declaring, Declaring MetaclassesMetaclass Dispatch in Both 3.X and 2.X
descriptors and, The descriptors special case
factory functions and, Using simple factory functions
inheritance and, Attribute Tree Construction, Inheritance and InstanceThe built-ins special case
instances and, Inheritance and InstanceThe built-ins special case, Managing instances instead of classesManaging instances instead of classes
methods in, Metaclass MethodsMetaclasses Versus Class Decorators: Round 3 (and Last)
model overview, The Metaclass ModelClass Statement Protocol
operator overloading and, Overloading class creation calls with normal classesOverloading class creation calls with metaclasses, Operator Overloading in Metaclass Methods
superclasses versus, Metaclass Versus Superclass
type object and, Metaclasses Are Subclasses of Type
usage considerations, To Metaclass or Not to MetaclassMetaclasses Versus Class Decorators: Round 1
usage examples, Example: Adding Methods to ClassesMetaclasses Versus Class Decorators: Round 3 (and Last)
version considerations, Declaration in 3.XMetaclass Dispatch in Both 3.X and 2.X
metafunctions, Decorators and Metaclasses: Part 1Function Decorator Basics, Usage
metaprograms, Example: Modules Are ObjectsExample: Modules Are Objects
method resolution order, Augmenting Methods: The Good Way (see MRO)
methods, Type-Specific Methods, Type-Specific Operations, Files, Built-in Numeric Tools, String Basics, String MethodsThe Original string Module’s Functions (Gone in 3.X), Method Call Syntax, The Original string Module’s Functions (Gone in 3.X)The Original string Module’s Functions (Gone in 3.X), String Formatting Method CallsFunctions versus expressions: A minor convenience, List method callsOther common list methods, Dictionaries, More Dictionary MethodsMore Dictionary Methods, Conversions, methods, and immutabilityConversions, methods, and immutability, Files in Action, Expression Statements, Using List Comprehensions on Files, Scopes: lambdas Can Be Nested Too, Method Calls, A First Example, Classes Can Intercept Python Operators, Step 2: Adding Behavior MethodsCoding Methods, Step 2: Adding Behavior Methods, Coding MethodsCoding Methods, Augmenting Methods: The Bad WayAugmenting Methods: The Good Way, Methods, Method Example, Calling Superclass Constructors, Other Method Call Possibilities, Other Method Call Possibilities, Right-Side and In-Place Uses: __radd__ and __iadd__In-Place Addition, Methods Are Objects: Bound or UnboundOther callables, Methods Are Objects: Bound or UnboundOther callables, Methods Are Objects: Bound or UnboundOther callables, Static Methods in 2.X and 3.X, Static Methods in 2.X and 3.X, Scopes in Methods and Classes, Providing Exception MethodsProviding Exception Methods, Class Blunders I: Decorating MethodsUsing descriptors to decorate methods, Metaclass MethodsMetaclasses Versus Class Decorators: Round 3 (and Last), Example: Adding Methods to ClassesMetaclass and class decorator equivalence?, Example: Applying Decorators to MethodsMetaclasses Versus Class Decorators: Round 3 (and Last)
(see also operator overloading)
about, Method Calls, Methods
adding, Step 2: Adding Behavior MethodsCoding Methods, Example: Adding Methods to ClassesMetaclass and class decorator equivalence?
attribute fetches, Method Call Syntax
augmenting, Augmenting Methods: The Bad WayAugmenting Methods: The Good Way
binary operator, Right-Side and In-Place Uses: __radd__ and __iadd__In-Place Addition
bound, Scopes: lambdas Can Be Nested Too, Methods Are Objects: Bound or UnboundOther callables, Static Methods in 2.X and 3.X
chaining, Using List Comprehensions on Files
coding, Coding MethodsCoding Methods
decorators and, Class Blunders I: Decorating MethodsUsing descriptors to decorate methods, Example: Applying Decorators to MethodsMetaclasses Versus Class Decorators: Round 3 (and Last)
dictionary, Dictionaries, More Dictionary MethodsMore Dictionary Methods
exception handler, Providing Exception MethodsProviding Exception Methods
expressions and, Expression Statements
file, Files, Files in Action
functions and, A First Example
instance, Other Method Call Possibilities
list, Type-Specific Operations, List method callsOther common list methods
metaclass, Metaclass MethodsMetaclasses Versus Class Decorators: Round 3 (and Last)
number-specific, Built-in Numeric Tools
as objects, Methods Are Objects: Bound or UnboundOther callables
scopes in, Scopes in Methods and Classes
static, Other Method Call Possibilities
string, Type-Specific Methods, String Basics, String MethodsThe Original string Module’s Functions (Gone in 3.X), The Original string Module’s Functions (Gone in 3.X)The Original string Module’s Functions (Gone in 3.X)
string formatting, String Formatting Method CallsFunctions versus expressions: A minor convenience
superclass constructors, Calling Superclass Constructors
tuple, Conversions, methods, and immutabilityConversions, methods, and immutability
unbound, Methods Are Objects: Bound or UnboundOther callables, Static Methods in 2.X and 3.X
underscores in, Classes Can Intercept Python Operators
usage examples, Method Example
microthreads, Stackless: Python for concurrency
min built-in function, Other Built-in Numeric Tools, Other Iteration Contexts, Timing Module: Homegrown
missing keys, Missing Keys: if TestsMissing Keys: if Tests, Avoiding missing-key errors
mix-in classes, Multiple Inheritance: “Mix-in” ClassesRoom for improvement: MRO, slots, GUIs, Coupling: Application to mix-in classesCoupling: Application to mix-in classes
__mod__ method, Method Calls
module search path, Usage Notes: import and reload, The Module Search PathOptimized byte code files, Module Lookup Rules Summary, Changing the Module Search PathChanging the Module Search Path, Path files, Running modules on the search path
about, Usage Notes: import and reload, The Module Search PathOptimized byte code files, Path files
changing, Changing the Module Search PathChanging the Module Search Path
lookup rules summary, Module Lookup Rules Summary
running modules, Running modules on the search path
modules, System Command Lines and Files, System Command Lines and Files, System Command Lines and Files, Import and Reload BasicsThe Grander Module Story: Attributes, The Grander Module Story: AttributesModules and namespaces, Modules and namespaces, Usage Notes: import and reload, Usage Notes: import and reload, Usage Notes: import and reload, Using exec to Run Module Files, Usage Notes: IDLE, Usage Notes: IDLE, Embedding Calls, The Python Conceptual Hierarchy, The Python Conceptual Hierarchy, Python’s Core Data Types, Numbers, Scope Details, Modules: The Big PictureWhy Use Modules?, Why Use Modules?, Python Program ArchitectureStandard Library Modules, How to Structure a ProgramImports and Attributes, Byte Code Files: __pycache__ in Python 3.2+Byte Code File Models in Action, The Module Search PathOptimized byte code files, Test Your Knowledge: Quiz, Module CreationOther Kinds of Modules, Other Kinds of Modules, Module UsageWhen import is required, The from Statement, import and from Are AssignmentsWhen import is required, Module NamespacesNamespace Nesting, Reloading Modulesreload Example, Test Your Knowledge: Quiz, Module Packages, Module Packages, Module Lookup Rules Summary, Module Design ConceptsModule Design Concepts, Data Hiding in Modules, Enabling Future Language Features: __future__, Mixed Usage Modes: __name__ and __main__Unit Tests with __name__, Example: Dual Mode CodeDocstrings: Module Documentation at Work, Changing the Module Search PathChanging the Module Search Path, The as Extension for import and from, Example: Modules Are ObjectsExample: Modules Are Objects, Example: Transitive Module ReloadsTesting reload variants, Module GotchasRecursive from Imports May Not Work, Module Name Clashes: Package and Package-Relative Imports, Statement Order Matters in Top-Level Code, from Copies Names but Doesn’t Link, Test Your Knowledge: Quiz, Classes and Instances, Classes Are Attributes in Modules, Classes Are Attributes in Modules, Example, Classes Versus Modules, Usage variation: Running on larger modules, Path files, Running modules on the search path
(see also from statement; import statement; packages)
about, System Command Lines and Files, Python’s Core Data Types, Numbers, Modules: The Big PictureWhy Use Modules?
as extension for import/from statements, The as Extension for import and from
attributes and, The Grander Module Story: AttributesModules and namespaces, How to Structure a ProgramImports and Attributes, Classes Are Attributes in Modules
byte code files, Byte Code Files: __pycache__ in Python 3.2+Byte Code File Models in Action
classes and, Classes and Instances, Classes Are Attributes in Modules, Example, Classes Versus Modules
common usage mistakes, Usage Notes: import and reload, Usage Notes: IDLE
copying names, The from Statement, import and from Are AssignmentsWhen import is required, from Copies Names but Doesn’t Link
creating, Module CreationOther Kinds of Modules
data hiding in, Data Hiding in Modules
design concepts, Module Design ConceptsModule Design Concepts
dual mode code example, Example: Dual Mode CodeDocstrings: Module Documentation at Work
embedding calls, Embedding Calls
enabling future language features, Enabling Future Language Features: __future__
exec built-in function and, Using exec to Run Module Files
extension, Other Kinds of Modules
importing, Module Packages
mixed usage modes, Mixed Usage Modes: __name__ and __main__Unit Tests with __name__
module search path, Usage Notes: import and reload, The Module Search PathOptimized byte code files, Module Lookup Rules Summary, Changing the Module Search PathChanging the Module Search Path, Path files, Running modules on the search path
name clashes, Module Name Clashes: Package and Package-Relative Imports
namespaces and, Modules and namespaces, Why Use Modules?, Module NamespacesNamespace Nesting
as objects, Example: Modules Are ObjectsExample: Modules Are Objects
potential gotchas, Module GotchasRecursive from Imports May Not Work
programs and, System Command Lines and Files, The Python Conceptual Hierarchy
Python program architecture and, Python Program ArchitectureStandard Library Modules
quiz questions and answers, Test Your Knowledge: Quiz, Test Your Knowledge: Quiz, Test Your Knowledge: Quiz
reloading, Import and Reload BasicsThe Grander Module Story: Attributes, Usage Notes: import and reload, Usage Notes: IDLE, Reloading Modulesreload Example, Example: Transitive Module ReloadsTesting reload variants
scope considerations, Scope Details
statements and, System Command Lines and Files, The Python Conceptual Hierarchy, Statement Order Matters in Top-Level Code
usage considerations, Module UsageWhen import is required, Usage variation: Running on larger modules
modulus operator, Formatting Expression Basics
mod_python package, Internet Scripting
MongoDB database, Nesting Revisited
movie database example, Example: Movie DatabasePreview: Mapping values to keys
MRO (method resolution order), Augmenting Methods: The Good Way, Multiple Inheritance: “Mix-in” Classes, Room for improvement: MRO, slots, GUIs, New-Style Class Changes, Diamond Inheritance ChangeExample: Mapping Attributes to Inheritance Sources, Cooperative Multiple Inheritance Method DispatchCoupling: Application to mix-in classes
about, New-Style Class Changes, Diamond Inheritance ChangeExample: Mapping Attributes to Inheritance Sources
new-style classes and, Multiple Inheritance: “Mix-in” Classes, Room for improvement: MRO, slots, GUIs
super built-in function and, Augmenting Methods: The Good Way, Cooperative Multiple Inheritance Method DispatchCoupling: Application to mix-in classes
__mro__ attribute, Room for improvement: MRO, slots, GUIs, New-Style Class Changes, More on the MRO: Method Resolution OrderTracing the MRO, Python’s inheritance algorithm: The simple version
about, Room for improvement: MRO, slots, GUIs, New-Style Class Changes, More on the MRO: Method Resolution OrderTracing the MRO
inheritance and, Python’s inheritance algorithm: The simple version
multiline block strings, Triple Quotes Code Multiline Block StringsTriple Quotes Code Multiline Block Strings
multiline statements, Entering multiline statements (see compound statements)
multiple context managers, Multiple Context Managers in 3.1, 2.7, and LaterMultiple Context Managers in 3.1, 2.7, and Later
multiple inheritance, Coding Class Trees, Multiple Inheritance: “Mix-in” ClassesRoom for improvement: MRO, slots, GUIs, New-Style Class Changes, Diamond Inheritance ChangeExample: Mapping Attributes to Inheritance Sources, Odd semantics: A magic proxy in Python 3.XPitfall: Adding multiple inheritance naively, Cooperative Multiple Inheritance Method DispatchCustomization: Same-argument constraints, Multiple Inheritance: Order MattersMultiple Inheritance: Order Matters
about, Coding Class Trees
class gotchas, Multiple Inheritance: Order MattersMultiple Inheritance: Order Matters
diamond patterns of, New-Style Class Changes, Diamond Inheritance ChangeExample: Mapping Attributes to Inheritance Sources
mix-in classes and, Multiple Inheritance: “Mix-in” ClassesRoom for improvement: MRO, slots, GUIs
super built-in function and, Odd semantics: A magic proxy in Python 3.XPitfall: Adding multiple inheritance naively, Cooperative Multiple Inheritance Method DispatchCustomization: Same-argument constraints
multiple instances, Classes Generate Multiple Instance ObjectsA First Example, Supporting multiple instances, Class Blunders II: Retaining Multiple Instances
multiple-target assignments, Assignment Statement Forms, Multiple-Target AssignmentsMultiple-target assignment and shared references
multiplication (*) operator, Numbers, Sequence Operations, Basic Operations, Basic List Operations
multiplying numbers, Numbers
repeating lists, Basic List Operations
repeating strings, Sequence Operations, Basic Operations
multithreading, Program Design: Minimize Global Variables, Why generator functions?
multiway branching in if statements, Multiway BranchingHandling larger actions, Multiway branch switches: The finale
mutable objects, Lists, Dictionaries, Lists, Avoiding Mutable Argument Changes, Combining keywords and defaults, Defaults and Mutable ObjectsDefaults and Mutable Objects, Changing mutables in modules
avoiding argument changes, Avoiding Mutable Argument Changes
changing in modules, Changing mutables in modules
default values for arguments, Combining keywords and defaults
dictionaries as, Dictionaries
function gotchas, Defaults and Mutable ObjectsDefaults and Mutable Objects
lists as, Lists, Lists