Index
A
- abstract base classes
- about / The ABCs of abstract base classes
- callable class, writing / Writing a callable class
- abstract base classes (ABC)
- Acceptance Test Driven Design (ATDD) / Using the unittest library for testing
- Accept header / Building a RESTful web service with Flask
- add-on test libraries
- additional function annotations
- writing / Writing additional function annotations
- algorithms
- approaching, ways / Functional programming design patterns
- alternative implementations
- designing / Designing alternative implementations
- Anaconda project
- URL / The math libraries
- and operator
- about / Using set operators
- argparse module / Choosing good script names
- ASCII
- working with / Working with Unicode, ASCII, and bytes
- assert statement
- defining / The assert statement
- assignment statement
- about / Simple assignment and variables
- attributes
- augmented assignment statement
- about / Augmented assignment
B
- bit-oriented operators
- using / Using the bit-oriented operators
- bits
- using / Using bits and Boolean values
- bool() function
- Boolean data
- Boolean values
- using / Using bits and Boolean values
- break statement
- defining / The continue and break statements
- executing / Breaking early from a loop
- built-in conversion functions
- built-in numeric packages
- numbers / The math libraries
- math / The math libraries
- cmath / The math libraries
- decimal / The math libraries
- fractions / The math libraries
- random / The math libraries
- built-in operators
- about / Introducing the built-in operators
- arithmetic / Introducing the built-in operators
- bit-oriented / Introducing the built-in operators
- comparison operators / Introducing the built-in operators, Making comparisons
- integers, using / Using integers
- rational numbers, using / Using rational numbers
- decimal numbers, using / Using decimal numbers
- floating-point numbers, using / Using floating-point numbers
- complex numbers, using / Using complex numbers
- built-in reductions
- bytes
- and Unicode, converting between / Converting between Unicode and bytes
- working with / Working with Unicode, ASCII, and bytes
- versus characters / The essential file concept
- byte string literals
- using / Using byte string literals
- byte value
- using / Using string and bytes values
C
- callable class
- writing / Writing a callable class
- callables
- defining / Looking at the five kinds of callables
- characters
- versus bytes / The essential file concept
- character user interface (CUI)
- about / The input() function
- class
- creating / Creating a class
- suite of statements, writing / Writing the suite of statements in a class
- class methods
- CLI applications
- building / Building CLI applications
- features / Building CLI applications
- command-line arguments, obtaining with argparse / Getting command-line arguments with argparse
- cmd module, using for interactive applications / Using the cmd module for interactive applications
- collection functions
- using / Using collection functions
- COMBINING DIACRITICAL CIRCUMFLEX
- about / Simple assignment and variables
- Comma-Separated Value (CSV) / The print() function
- comment / Examining syntax rules
- comparison operators
- about / Making comparisons, Comparison operators
- combining / Combining comparisons to simplify the logic
- float values, testing / Testing float values
- object IDs, comparing with is operator / Comparing object IDs with the is operator
- equality comparison / Equality and object hash values
- object hash values / Equality and object hash values
- complex numbers
- using / Using complex numbers
- compound statement
- about / Simplified syntax rules
- comprehension
- about / Consequences and next steps
- comprehensions
- using / Using generator expressions and comprehensions
- writing / Writing comprehensions
- conditions
- contextlib
- file-like objects, closing with / Closing file-like objects with contextlib
- context manager
- using, via with statement / Using a context manager via the with statement
- continue statement
- defining / The continue and break statements
- copy() method
- about / Accessing a list
- count() method
- about / Accessing a list
- CPython
- about / Considering some alternatives
- Create, Retrieve, Update, and Delete (CRUD) / Using the shelve module as a database
- Create, Retrieve, Update and Delete (CRUD) / Building a RESTful web service with Flask
D
- database
- shelve module, using as / Using the shelve module as a database
- data types
- decimal numbers
- using / Using decimal numbers
- Decimal objects
- defining / Using the built-in conversion functions
- decorator
- defining / Defining our own decorator
- dictionaries
- used, for filling in *kw / Using sequences and dictionaries to fill in *args and *kw
- used, for filling in *args / Using sequences and dictionaries to fill in *args and *kw
- difflib module
- docstring, function
- writing / Writing a function's docstring
- docstrings
- writing / Writing docstrings
- documentation
- writing, with RST markup / Writing documentation with RST markup
- docutils tools
E
- EAFP programming
- else clause
- using, on loop / Using the else clause on a loop
- empty except clause
- defining / The empty except clause
- encapsulation
- except clause
- exception classes, matching / Matching exception classes in an except clause
- exception
- defining / The core exception concept
- creating / Examining the exception object
- exception classes
- matching, in except clause / Matching exception classes in an except clause
- exception object
- examining / Examining the exception object
- exceptions
- creating / Creating our own exceptions
- except statement
- exclusive or Boolean operation
- about / Using set operators
- expressions
- external libraries
F
- file, concept
- about / The essential file concept
- text files, opening / Opening text files
- text lines, filtering / Filtering text lines
- raw bytes / Working with raw bytes
- file-like objects, using / Using file-like objects
- file-like objects
- using / Using file-like objects
- closing, with contextlib / Closing file-like objects with contextlib
- finally clause
- using / Using a finally clause
- Flask
- used, for building RESTful web service / Building a RESTful web service with Flask
- floating-point numbers
- using / Using floating-point numbers
- float values
- testing / Testing float values
- format() method
- using, for making readable output / Using the format() method to make more readable output
- field values / Using the format() method to make more readable output
- for statement
- defining / Processing collections with the for statement
- collections, processing with / Processing collections with the for statement
- literal lists, using / Using literal lists in a for statement
- range() function, using / Using the range() and enumerate() functions
- enumerate() function, using / Using the range() and enumerate() functions
- using, with iterable collections / Using the for statement with iterable collections
- consequences / Consequences and next steps
- Fraction objects
- defining / Using the built-in conversion functions
- function
- evaluating, with positional argument / Evaluating a function with positional or keyword arguments
- evaluating, with keyword argument / Evaluating a function with positional or keyword arguments
- functional programming
- design patterns / Functional programming design patterns
- functions
- defining, with positional parameters / Defining functions with positional parameters
- functions, with positional parameters
- multiple parameters, defining / Defining multiple parameters
- return statement, using / Using the return statement
G
- Ganglia monitoring system
- general exceptions
- matching / Matching more general exceptions
- generator expressions
- using / Using generator expressions and comprehensions
- limitations / Limitations of generator expressions
- generator functions
- defining, with yield statement / Defining generator functions with the yield statement
- git / Choosing good script names
- global Singleton object / Creating a reusable module
- GREEK SMALL LETTER PI
- about / Simple assignment and variables
- GUI applications
- building / Building GUI applications
- sophisticated packages, using / Using more sophisticated packages
H
- head
- using / Using the head, *tail assignment
- help subsystem
- interacting with / Interacting with the help subsystem
- pydoc program, using / Using the pydoc program
- higher-order function
- about / Using the higher-order functions
- higher-order functions
- using / Using the higher-order functions
- writing / Writing our own higher-order functions
- HTML documentation
- creating, from RST source / Creating HTML documentation from an RST source
- hybrid library/application modules
- creating / Creating a hybrid library/application module
I
- ICO file format
- URL, for wiki / Working with raw bytes
- if-elif-else statement
- defining / The if-elif-else statement
- elif clauses, adding / Adding elif clauses
- immutability
- immutable argument value
- defining / Mutable and immutable argument values
- immutable object, Python
- consequences / The consequences of immutability
- import, from libraries
- import random / The math libraries
- from random import gauss, randint / The math libraries
- from random import * / The math libraries
- import statement
- index() method
- about / Accessing a list
- inheritance
- about / Using inheritance to simplify class definitions
- using, to simplify class definitions / Using inheritance to simplify class definitions
- using / Using inheritance to simplify class definitions
- multiple inheritance, using / Using multiple inheritance and the mixin design pattern
- mixin design pattern, using / Using multiple inheritance and the mixin design pattern
- input() function
- about / The input() function
- insert() method
- instance variables
- integers
- using / Using integers
- bit-oriented operators, using / Using the bit-oriented operators
- Internet protocols / Web services and Internet protocols
- Iron Python
- is operator
- object IDs, comparing with / Comparing object IDs with the is operator
- iterable collections
- iterators
- itertools module
J
- Jython
K
- keyword arguments / The print() function
L
- @lru_cache decorator
- lambdas
- defining / Defining lambdas
- last recently used (LRU)
- less program / Interacting with the help subsystem
- Linux
- Python 3.4, upgrading in / Upgrading to Python 3.4 in Linux
- Linux distributions
- prebuilt packages, installing / Upgrading to Python 3.4 in Linux
- URL / Upgrading to Python 3.4 in Linux
- building, from source / Upgrading to Python 3.4 in Linux
- Liskov Substitution Principle (LSP)
- list
- list collection
- using / Using the list collection
- list operators, using / Using list operators
- list, mutating with subscripts / Mutating a list with subscripts
- list, mutating with method functions / Mutating a list with method functions
- list, accessing / Accessing a list
- little-endian byte ordering
- about / Working with raw bytes
- locale module
- used, for personalization / Using the locale module for personalization
- logging events
- about / Logging events and conditions
- conditions / Logging events and conditions
- logging system
- configuring / Configuring the logging system
- logical operators
- defining / Logic operators – and, or, not, if-else
- and / Logic operators – and, or, not, if-else
- or / Logic operators – and, or, not, if-else
- not / Logic operators – and, or, not, if-else
- if-else / Logic operators – and, or, not, if-else
- short-circuit evaluation / Short-circuit (or non-strict) evaluation
- Look Before You Leap (LBYL)
M
- Mac OS X
- Python 3.4, upgrading to / Upgrading to Python 3.4 in Mac OS X
- map() function
- about / Using the higher-order functions
- mappings
- about / Mappings
- dictionary operators, using / Using dictionary operators
- dictionary mutators, using / Using dictionary mutators
- methods used, for accessing items / Using methods for accessing items in a mapping
- extensions, using from collections module / Using extensions from the collections module
- MapReduce framework
- plugging into / Plugging into a MapReduce framework
- math libraries
- about / The math libraries
- matplotlib / Building GUI applications
- max() function
- about / Using collection functions
- memoization / Writing a callable class
- metaprogramming, with decorators
- metaprogramming, with metaclasses
- Method Resolution Order (MRO) / Pythonic object-oriented programming
- methods
- methods, mapping
- microframework
- about / Using a web framework
- min() function
- about / Using collection functions
- mixin / Using multiple inheritance and the mixin design pattern
- mode string
- characters, versus bytes / The essential file concept
- allowed operations / The essential file concept
- mod_wsgi
- about / Building web applications
- URL / Building web applications
- more command / Interacting with the help subsystem
- multiple assignment
- about / Multiple assignment
- repeated assignment, using / Using repeated assignment
- multiple loops
- mutability
- mutable argument value
- defining / Mutable and immutable argument values
- mutable class variables
- using / Using mutable class variables
- mutable default values
- working with / A warning about mutable default values
- mutable object
- about / The consequences of immutability
N
- ** notation
- * notation
- namespaces
- working with / Working with namespaces
- global variable, assigning / Assigning a global variable
- non-local variable, assigning / Assigning a non-local variable
- nested function definitions
- about / Nested function definitions
- nested try statements
- using / Using nested try statements
- network adapter
- about / The essential file concept
- NLTK
- None object
- about / The None object
- defining / The logic of the None object
- Not a Number (NaN)
- about / The core exception concept
- numeric operands
- complex / Expressions, operators, and data types
- float / Expressions, operators, and data types
- fractions.Fraction / Expressions, operators, and data types
- decimal.Decimal / Expressions, operators, and data types
- int / Expressions, operators, and data types
- numeric tower
- about / The numeric tower
- NumPy
- URL / The math libraries
O
- Object-Relational Mapper (ORM) layer
- about / Using a web framework
- object-relational mapping (ORM)
- using / Using object-relational mapping
- open() function / The essential file concept
- operators
- about / Expressions, operators, and data types
- arithmetic / Expressions, operators, and data types
- bit-oriented / Expressions, operators, and data types
- comparison / Expressions, operators, and data types
- using, on non-numeric data / Using operators on non-numeric data
- operators, for set objects
- mutators / Using the set collection
- accessors / Using the set collection
- optional parameters
- defining, via default values / Defining optional parameters via default values
P
- @property decorator
- package
- about / Creating a package
- creating / Creating a package
- package search path
- viewing / Seeing the package search path
- partitioning
- pass statement
- defining / The pass statement as a placeholder
- physical format
- considerations / Physical format considerations
- physical line / Examining syntax rules
- Pillow / Building GUI applications
- pop() method
- primitive types
- about / Python language concepts
- print() function
- about / The print() function
- prompt, help modes
- help> prompt / Interacting with the help subsystem
- -- More -- prompt / Interacting with the help subsystem
- Mac OS X and Linux $ prompt / Interacting with the help subsystem
- properties
- about / Using properties
- using / Using properties
- PTVS
- pydoc program
- using / Using the pydoc program
- modes / Using the pydoc program
- Pygame framework
- PyPI
- using / Using the Python Package Index – PyPI
- URL / Using the Python Package Index – PyPI, Leveraging PyPI – the Python Package Index
- pip used, for gathering modules / Using pip to gather modules
- easy_install used, for adding modules / Using easy_install to add modules
- modules, installing manually / Installing modules manually
- leveraging / Leveraging PyPI – the Python Package Index
- PyPy
- Python
- installing / Installation or upgrade
- upgrading / Installation or upgrade
- installing, on Windows / Installing Python on Windows
- alternatives, for implementation / Considering some alternatives
- defining / Python language concepts
- object types, versus variable declarations / Object types versus variable declarations
- variables, naming / Avoiding confusion when naming variables
- garbage collection, via reference counting / Garbage collection via reference counting
- little-used del statement / The little-used del statement
- Python 3.4
- upgrading, in Mac OS X / Upgrading to Python 3.4 in Mac OS X
- Tkinter package, adding / Adding the Tkinter package
- upgrading, in Linux / Upgrading to Python 3.4 in Linux
- Python applications
- types / Types of applications
- CLI applications, building / Building CLI applications
- GUI applications, building / Building GUI applications
- Python code
- organizing / Organizing Python code
- Python ecosystem
- about / The Python ecosystem
- extensibility, via add-ons / The idea of extensibility via add-ons
- PyPI, using / Using the Python Package Index – PyPI
- Python Enhancement Proposal (PEP)
- Python Enhancement Proposal (PEP) 3333
- Python Enhancement Proposal (PEP) number 8
- URL / Examining syntax rules
- Pythonic object-oriented programming
- about / Pythonic object-oriented programming
- type casts / Trying to do type casting
- encapsulation, designing for / Designing for encapsulation and privacy
- privacy, designing for / Designing for encapsulation and privacy
- Python installer
- Python interpreters
- defining / Looking at other Python interpreters
- Python namespace
- about / The Python namespace concept
- globals / Globals and locals
- locals / Globals and locals
- Python Package Index
- Python Package Index (PyPI)
- Python Tools for Visual Studio (PTVS)
- about / Considering some alternatives
- Python web frameworks
- URL / Types of applications
R
- range() object
- rational numbers
- using / Using rational numbers
- raw bytes
- working with / Working with raw bytes
- raw string
- about / Using raw string literals
- raw string literals
- using / Using raw string literals
- regular expressions
- matching regular expression / Using the re module to parse strings
- searching regular expression / Using the re module to parse strings
- parsing pattern / Using the re module to parse strings
- using / Using regular expressions
- regular expression string
- creating / Creating a regular expression string
- re module
- about / Summary of the standard string libraries
- used, for parsing strings / Using the re module to parse strings
- repeated assignment
- using / Using repeated assignment
- REPL
- using / Using the Read-Evaluate-Print Loop (REPL)
- Python interpreter, starting / Confirming that things are working
- arithmetic, performing / Doing simple arithmetic
- results, assigning to variables / Assigning results to variables
- import statement, using / Using import to add features
- replace() function
- about / Using string methods
- RESTful web service
- building, with Flask / Building a RESTful web service with Flask
- reusable module
- creating / Creating a reusable module
- RST markup
- about / Writing docstrings
- used, for writing documentation / Writing documentation with RST markup
- RST source
- HTML documentation, creating from / Creating HTML documentation from an RST source
S
- @staticmethod decorator
- SciPy
- URL / The math libraries
- script
- about / Script file rules
- running / Script file rules
- running, by filename / Running a script by the filename
- running, by module name / Running a script by its module name
- running, OS shell rules used / Running a script using OS shell rules
- names, selecting / Choosing good script names
- script file rules
- about / Script file rules
- script files
- creating / Creating simple script files
- rules / Creating simple script files
- syntax rules, defining / Simplified syntax rules
- sequence
- sorting / Three ways to sort a sequence
- sorting, via key function / Sorting via a key function
- sorting, via wrapping and unwrapping / Sorting via wrapping and unwrapping
- sequences
- working with / Working with sequences
- slicing / Slicing and dicing a sequence
- dicing / Slicing and dicing a sequence
- used, for filling in *args / Using sequences and dictionaries to fill in *args and *kw
- used, for filling in *kw / Using sequences and dictionaries to fill in *args and *kw
- set collection
- using / Using the set collection
- set operators, using / Using set operators
- set, mutating with method functions / Mutating a set with method functions
- augmented assignment, using with sets / Using augmented assignment with sets
- set, accessing with operators / Accessing a set with operators and method functions
- set, accessing with method functions / Accessing a set with operators and method functions
- shelve module
- using, as database / Using the shelve module as a database
- short-circuit evaluation / Short-circuit (or non-strict) evaluation
- short-circuit evaluation rule
- simple statement
- about / Simplified syntax rules
- slice
- about / Slicing and dicing a sequence
- Solid State Drives (SSD)
- about / The essential file concept
- sort() method
- sorted() function
- Sphinx tool
- using / Using the Sphinx tool
- URL / Using the Sphinx tool
- about / Using the Sphinx tool
- splitting
- SQLAlchemy / Using object-relational mapping
- sqlite database
- using / Using the sqlite database
- SQLObject / Using object-relational mapping
- Stackless
- standard library
- leveraging / Leveraging the standard library
- standard string libraries
- features / Summary of the standard string libraries
- string / Summary of the standard string libraries
- re / Summary of the standard string libraries
- difflib / Summary of the standard string libraries
- textwrap / Summary of the standard string libraries
- unicodedata / Summary of the standard string libraries
- stringprep / Summary of the standard string libraries
- statement
- about / Doing simple arithmetic
- static
- about / Writing static methods
- static methods
- writing / Writing static methods
- string details
- accessing / Accessing the details of a string
- string literals
- writing / Writing string literals
- short string / Writing string literals
- long string / Writing string literals
- string methods
- using / Using string methods
- Transformers / Using string methods
- Creators / Using string methods
- Accessors / Using string methods
- Parsers / Using string methods
- string module
- string operators
- using / Using the string operators
- stringprep module
- strings
- parsing, into substrings / Parsing strings into substrings
- joining / Splitting, partitioning, and joining strings
- string value
- using / Using string and bytes values
- string values, Python
- unicode / Using string and bytes values
- bytes / Using string and bytes values
- sum() function
- about / Using collection functions
- syntax rules
- defining / Simplified syntax rules
- examining / Examining syntax rules
T
- *tail assignment
- using / Using the head, *tail assignment
- Tcl/Tk
- TeX Live
- text files
- opening / Opening text files
- text lines
- filtering / Filtering text lines
- textwrap module
- Tk graphics / Building GUI applications
- tkinter module / Building GUI applications
- Tk user interface widget toolkit / Building GUI applications
- Tk widgets / Building GUI applications
- try statement
- tuple
- using / Using the tuple collection
- turtle module / Building GUI applications
- type casts
- about / Trying to do type casting
U
- Unicode
- and bytes, converting between / Converting between Unicode and bytes
- working with / Working with Unicode, ASCII, and bytes
- unicodedata module
- unittest library
- using, for testing / Using the unittest library for testing
- doctest, combining with / Combining doctest and unittest
- unit tests
- writing, with doctest / Writing unit tests with doctest
- unpack() function
- about / Working with raw bytes
- use cases, for exceptions
- about / Use cases for exceptions
- user experience (UX) issues / Running a script by the filename
V
- variables
- about / Simple assignment and variables
W
- warning classes
- DeprecationWarning / Issuing warnings instead of exceptions
- PendingDeprecationWarning / Issuing warnings instead of exceptions
- ImportWarning / Issuing warnings instead of exceptions
- warnings module
- defining / Issuing warnings instead of exceptions
- web applications
- about / Building web applications
- building / Building web applications
- building, web framework used / Using a web framework
- Web Services Gateway Interface (WSGI) design / Building web applications
- web services protocols / Web services and Internet protocols
- while statement
- iterating with / Iterating with the while statement
- Windows
- Python, installing on / Installing Python on Windows
- with statement
- context manager, using via / Using a context manager via the with statement
- wrap-sort-unwrap design pattern
- about / Three ways to sort a sequence
Y
- yield statement
- generator functions, defining with / Defining generator functions with the yield statement
Z
- ZeroDivisionError exception
- considerations / The core exception concept