Index

Symbols

A

B

C

D

E

F

G

H

I

  • if clause, 36, 174

  • if statements, 19

  • immutable objects

    • creating, 250251

    • using in dictionaries and sets, 256260

  • implicit string concatenation, 6266

  • imports, 5, 592, 601, 604605

  • in operator, 117, 119

  • index_words function, 182, 183184

  • IndexError exception, 336

  • indexing, 7273. See also slicing

    • negative, 68

    • parallel, 7980

    • with slicing, 6769

    • strings, 1011

  • inheritance

  • inheriting classes for custom container types, 260264

  • initializing parent classes, 235236

  • inline negation, 5

  • insert_value, profiling, 448451

  • insertion ordering, dictionary, 109116

  • insertion_sort, profiling, 448451

  • integration tests, 541542

  • interactive debugging, 565568

  • interpolated format strings, 5658

  • I/O

  • isinstance function, 206

  • islice function, 104

  • islice method, 72

  • iter built-in function, 8991

  • iteration/iterators, 77, 182183. See also loop/s

    • exception, 88

    • generator, 87

    • lists, 7980, 87

    • over arguments, 8792

    • over containers, 9598

    • over dictionaries, 9293, 109116

    • over lists, 9495

    • over sets, 93, 96

    • passing into generators as arguments, 188195

    • passing to all built-in function, 98100

    • passing to any built-in function, 100101

    • StopIteration exception, 88

    • zip generator, 8081

  • iterator protocol, 8992

  • itertools, 72, 185186

    • accumulate function, 106107

    • batched function, 105106

    • chain function, 102

    • combinations function, 108

    • combinations_with_replacement function, 108

    • cycle function, 103

    • dropwhile function, 105

    • filterfalse function, 105

    • islice function, 104

    • pairwise function, 106

    • permutations function, 107

    • product function, 107

    • repeat function, 103

    • takewhile function, 104105

    • tee function, 103

    • zip_longest function, 81, 103104

J-K

L

M

N

  • namedtuple function, 259

  • NameError exception, 147

  • negative indexing, 68

  • None, using as default argument value, 157160

  • nonlocal statement, 148149

  • normalization function, 87, 89

  • normalize_defensive function, 9192

  • Numba module, 461

  • Numby module, 461

O

P

  • packages, 588

  • pairwise function, 106

  • parallel indexing, 7980

  • parallelism, 319

    • concurrent.futures, 393397

    • data races, preventing, 330333

    • fan-out, 350353

    • managing child processes, 320324

  • parent class

  • parent process, decoupling child process from, 321

  • parentheses

    • assignment expressions, 2223

    • single-element tuple, 1619

  • partial function, 171172

  • patch functions, 555558

  • PEP 8 (Python Enhancement Proposal #8), 3

    • automation, 56

    • expressions and statements, 45

    • imports, 5

    • naming, 4

    • whitespace, 34

  • performance. See also profiling

    • CPython, 475

    • engineering, 447

    • extension modules, 467474

    • lazy-loading modules, 478485

    • loading modules from zip archives, 622623

    • metrics, 447

    • microbenchmarks, 490491, 512517

    • producer–consumer queue, 504509

    • profiling, 448453

    • replacing Python with another programming language, 458462

    • search, 501503

    • timeit microbenchmarks, 453458

  • permutations function, 107

  • pickle module, 526528

    • default attribute values, 528530

    • stable import paths, 531532

    • versioning classes, 530531

  • pip tool, 575577

  • pipeline, 333337, 416417

  • piping data into a subprocess, 321322

  • pkgutil module, 624626

  • Point objects, 256258

  • polymorphism, 207210, 230235

  • porting code to use coroutines and asyncio, 368384

    • bottom-up approach, 387388

    • top-down approach, 384387

  • positional arguments, variable, 150152

  • positional-only arguments, 164166

  • postmortem debugging, 568570

  • preemptive multithreading, 325, 331333

  • pretty method, 209

  • pretty print, 215

  • preventing objects from being modified, 251254

  • print function, 5862

  • print_callees method, 452453

  • print_callers method, 452

  • priority queue, 509519

  • private attributes, 246247

  • producer–consumer queue, 504509

  • producing combinations of items from iterators

    • accumulate function, 106107

    • batched function, 105106

    • combinations function, 108

    • combinations_with_replacement function, 108

    • pairwise function, 106

    • permutations function, 107

    • product function, 107

  • product function, 107

  • profiling, 448

    • insertion_sort and insert_value, 448451

    • print_callees method, 452453

    • print_callers method, 452

    • utility functions, 451

  • programs. See also code; performance

  • protected attributes, 247250

  • public attributes, 245250, 266269

  • pylint, 6

  • PyPI (Python Package Index), 575

  • Python

    • C extension API, 460, 465

    • knowing the version you’re using, 13

    • replacing with another programming language, 458462

    • support for threads, 327329

  • Pythonic style, 1

Q

  • quantize method, 525

  • query string parameter, 89

  • queue

  • Queue class, 337344, 353360

  • quota, leaky-bucket algorithm, 270273

R

S

T

U

  • underscore (_), 213

  • Unicode

    • to binary conversion, 42

    • code points, 42

    • sandwich, 4243

  • unit tests, 542547

  • unittest module, 533535, 548

  • unpacking, 1215

  • update method, 96

  • user-defined classes, 137

  • UTC (Coordinated Universal Time), 519

  • utility functions, 451

V

W

X-Y-Z