Book Image

Getting Started with Python

By : Fabrizio Romano, Benjamin Baka, Dusty Phillips
Book Image

Getting Started with Python

By: Fabrizio Romano, Benjamin Baka, Dusty Phillips

Overview of this book

This Learning Path helps you get comfortable with the world of Python. It starts with a thorough and practical introduction to Python. You’ll quickly start writing programs, building websites, and working with data by harnessing Python's renowned data science libraries. With the power of linked lists, binary searches, and sorting algorithms, you'll easily create complex data structures, such as graphs, stacks, and queues. After understanding cooperative inheritance, you'll expertly raise, handle, and manipulate exceptions. You will effortlessly integrate the object-oriented and not-so-object-oriented aspects of Python, and create maintainable applications using higher level design patterns. Once you’ve covered core topics, you’ll understand the joy of unit testing and just how easy it is to create unit tests. By the end of this Learning Path, you will have built components that are easy to understand, debug, and can be used across different applications. This Learning Path includes content from the following Packt products: • Learn Python Programming - Second Edition by Fabrizio Romano • Python Data Structures and Algorithms by Benjamin Baka • Python 3 Object-Oriented Programming by Dusty Phillips
Table of Contents (31 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
8
Stacks and Queues
10
Hashing and Symbol Tables
Index

Index

A

  • absolute imports / Absolute imports
  • abstract base classes (ABCs)
    • about / Abstract base classes
    • using / Using an abstract base class
    • creating / Creating an abstract base class
    • demystifying / Demystifying the magic
  • abstract factory pattern / The abstract factory pattern
  • abstraction / Hiding details and creating the public interface, Inheritance provides abstraction
  • access control / Who can access my data?
  • adapter pattern / The adapter pattern
  • adjacency / Graphs
  • adjacency list / Adjacency list
  • adjacency matrix / Adjacency matrix
  • aggregation / Composition
  • algorithm analysis, approaches
    • average case analysis / Amortized analysis
    • benchmarking / Amortized analysis
  • algorithm design
    • divide and conquer paradigm / Algorithm design paradigms
    • dynamic programming approach / Algorithm design paradigms
  • amortized analysis / Amortized analysis
  • anonymous functions / Anonymous functions
  • append method / A faster append operation
  • arguments / Behaviors are actions
  • arrays / Arrays
  • assertion methods
    • about / Assertion methods
    • assertGreater / Assertion methods
    • assertGreaterEqual / Assertion methods
    • assertLess / Assertion methods
    • assertLessEqual / Assertion methods
    • assertIn / Assertion methods
    • assertNotIn / Assertion methods
    • assertIsNone / Assertion methods
    • assertIsNotNone / Assertion methods
    • assertSameElements / Assertion methods
    • assertSequenceEqualassertDictEqual / Assertion methods
    • assertSetEqual / Assertion methods
    • assertListEqual / Assertion methods
    • assertTupleEqual / Assertion methods
  • asymptotic analysis / Asymptotic analysis
  • attributes
    • specifying / Specifying attributes and behaviors
    • functions, using as / Using functions as attributes
  • average case analysis / Amortized analysis

B

  • backtracking
    • about / Backtracking
    • example / Backtracking
  • behaviors
    • specifying / Specifying attributes and behaviors
    • about / Behaviors are actions
  • benchmarking / Amortized analysis
  • big O notation / Big O notation
  • binary mode
    • files, reading / Reading and writing in binary mode
    • files, writing / Reading and writing in binary mode
  • binary search
    • about / Binary search
    • example / Binary search
  • binary search tree (BST)
    • about / Binary search trees
    • example / Binary search trees
    • implementation / Binary search tree implementation
    • operations / Binary search tree operations
    • maximum nodes, finding / Finding the minimum and maximum nodes
    • minimum nodes, finding / Finding the minimum and maximum nodes
    • nodes, inserting / Inserting nodes
    • nodes, deleting / Deleting nodes
    • tree, searching / Searching the tree
    • benefits / Benefits of a binary search tree
  • binary trees / Binary trees
  • Booleans / Booleans
  • bracket-matching application, stack / Bracket-matching application
  • branching / Conditional programming
  • breadth-first search
    • about / Breadth-first search
    • code / Breadth-first search
  • breadth first traversal / Breadth-first traversal
  • break statement / The break and continue statements
  • bubble sort
    • about / Bubble sort
    • implementing / Bubble sort
  • built-in data types
    • numbers / Numbers
    • immutable sequences / Immutable sequences
    • mutable sequences / Mutable sequences
    • set types / Set types
    • mapping types / Mapping types – dictionaries
    • collections module / The collections module
  • built-in functions / Built-in functions
    • about / Python built-in functions
    • len() function / The len() function
    • reversed() function / Reversed
    • enumerate function / Enumerate
    • for file I/O / File I/O
    • with context manager / Placing it in context
  • byte arrays / Byte arrays
  • bytes / Strings and bytes

C

  • callable objects
    • creating / Callable objects
  • CamelCase notation / Creating Python classes
  • chaining / Chaining
  • ChainMap / ChainMap
  • child / Terminology
  • circular list
    • about / Circular lists
    • elements, appending / Appending elements
    • elements, deleting / Deleting an element
    • iterating through / Iterating through a circular list
  • classes / Objects and classes, Objects and classes
  • Classes section, Python tutorial
    • reference / Scopes
  • class variables / Basic inheritance
  • code
    • guidelines / Guidelines on how to write good code
    • documenting / Documenting your code
  • code coverage / How much testing is enough?
  • collections module
    • about / The collections module
    • namedtuple / namedtuple
    • defaultdict / defaultdict
    • ChainMap / ChainMap
  • combinatoric generators / Combinatoric generators
  • Comma-Separated Value (CSV) / Case study
  • command-line notebook application
    • case study / Case study
  • command pattern / The command pattern
  • complexity classes
    • about / Runtime analysis
    • composing / Composing complexity classes
  • complex numbers / Complex numbers
  • composite pattern / The composite pattern
  • composition / Composition
  • comprehensions
    • about / Comprehensions
    • list comprehensions / List comprehensions
    • dictionary comprehensions / Set and dictionary comprehensions
    • set comprehensions / Set and dictionary comprehensions
    • generator expressions / Generator expressions
  • concepts, graphs
    • node / Graphs
    • vertex / Graphs
    • edge / Graphs
    • loop / Graphs
    • degree of vertices / Graphs
    • adjacency / Graphs
    • path / Graphs
  • concepts, trees
    • node / Terminology
    • root node / Terminology
    • sub tree / Terminology
    • degree / Terminology
    • leaf node / Terminology
    • edge / Terminology
    • parent / Terminology
    • child / Terminology
    • sibling / Terminology
    • level / Terminology
    • height / Terminology
    • depth / Terminology
  • conditional programming
    • about / Conditional programming
    • elif / A specialized else – elif
    • ternary operator / The ternary operator
  • console / Your friend, the console
  • constructor / Initializing the object
  • contextlib
    • URL / Using a context manager to open a file
  • context manager
    • used, for opening files / Using a context manager to open a file
    • about / Placing it in context
    • creating / Placing it in context
  • continue statement / The break and continue statements
  • coroutines
    • about / Coroutines
    • log parsing / Back to log parsing
    • exceptions, throwing / Closing coroutines and throwing exceptions
    • closing / Closing coroutines and throwing exceptions
    • generators and functions, relationship between / The relationship between coroutines, generators, and functions
  • custom exceptions
    • defining / Defining our own exceptions

D

  • data
    • persisting, on disk / Persisting data on disk
    • serializing, with pickle / Serializing data with pickle
    • saving, with shelve / Saving data with shelve
    • saving, to database / Saving data to a database
    • as objects / Data describes objects
  • database
    • data, saving / Saving data to a database
  • database management systems (DBMS) / Saving data to a database
  • Data Compression and Archiving
    • URL / File and directory compression
  • data interchange formats
    • about / Data interchange formats
    • JSON, working with / Working with JSON
    • custom encoding, with JSON / Custom encoding/decoding with JSON
    • custom decoding, with JSON / Custom encoding/decoding with JSON
  • Data Model, official Python documentation
    • reference / A proper introduction
  • data structures
    • selecting / How to choose data structures
  • decimal numbers / Fractions and decimals
  • decorator pattern
    • about / The decorator pattern
    • example / A decorator example
    • using, in Python / Decorators in Python
  • decorators
    • properties, creating / Decorators – another way to create properties
  • defaultdict / defaultdict
  • default values / Keyword arguments and default values
  • degree / Terminology
  • degree of vertex / Graphs
  • depth-first search / Depth-first search
  • depth first traversal
    • about / Depth-first traversal
    • in-order traversal, and infix notation / In-order traversal and infix notation
    • pre-order traversal, and prefix notation / Pre-order traversal and prefix notation
    • post-order traversal, and postfix notation / Post-order traversal and postfix notation.
  • design patterns
    • about / Design patterns in brief
    • case study / Case study
  • deterministic selection
    • about / Deterministic selection
    • pivot selection / Pivot selection
    • median of medians / Median of medians
    • partitioning step / Partitioning step
  • dictionaries / Mapping types – dictionaries
  • dictionary comprehensions / Set and dictionary comprehensions
  • different_action(other, arguments) / The adapter pattern
  • directed graph / Directed and undirected graphs
  • directories
    • working with / Working with files and directories
    • existence, checking / Checking for file and directory existence
    • manipulating / Manipulating files and directories
    • content, inspecting / Directory content
    • compression / File and directory compression
  • discounts
    • applying / Applying discounts
  • dispatcher / Applying discounts
  • divide and conquer paradigm / Algorithm design paradigms, Divide and conquer - long multiplication
  • docstrings / Documenting your code, Explaining yourself
  • don't repeat yourself (DRY) principle / How do we use modules and packages?
  • Don't Repeat Yourself (DRY) principle / Removing duplicate code
  • double-precision floating-point format
    • reference / Real numbers
  • doubly linked list
    • about / Doubly linked lists, Doubly linked list
    • append operation / Append operation
    • delete operation / Delete operation
  • doubly linked list node / A doubly linked list node
  • duck typing / Inheritance provides abstraction
  • duplicate code
    • removing / Removing duplicate code
  • dynamic programming approach / Algorithm design paradigms

E

  • edge / Terminology, Graphs
  • elif condition / A specialized else – elif
  • else clause / A special else clause
  • encapsulation / Hiding details and creating the public interface
  • endpoints
    • finding / Finding endpoints
    • simple node implementation / Node
  • enums / Enums
  • exception / A special else clause
  • 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
    • throwing / Closing coroutines and throwing exceptions
  • expensive objects
    • imitating / Imitating expensive objects
  • expression trees / Expression trees

F

  • facade pattern / The facade pattern
  • file I/O
    • built-in functions / File I/O
  • files
    • opening / Opening files
    • opening, with context manager / Using a context manager to open a file
    • reading / Reading and writing to a file
    • writing / Reading and writing to a file
    • overriding, protecting against / Protecting against overriding an existing file
    • checking / Checking for file and directory existence
    • manipulating / Manipulating files and directories
    • compression / File and directory compression
  • fixtures / A completely different way to set up variables
  • flyweight pattern / The flyweight pattern
  • for loop / The for loop
  • formatted string literals / String formatting
  • fractions / Fractions and decimals
  • functions
    • about / How do we use modules and packages?
    • benefits / Why use functions?
    • code duplication, reducing / Reducing code duplication
    • complex task, splitting / Splitting a complex task
    • implementation details, hiding / Hiding implementation details
    • readability, improving / Improving readability
    • traceability, improving / Improving traceability
    • tips / A few useful tips
    • recursive functions / Recursive functions
    • anonymous functions / Anonymous functions
    • attributes / Function attributes
    • built-in functions / Built-in functions
    • example / One final example
    • as objects / Functions are objects too
    • using, as attributes / Using functions as attributes
    • as callable objects / Callable objects
    • coroutines and generators, relationship between / The relationship between coroutines, generators, and functions

G

  • generalizations
    • unpacking / Additional unpacking generalizations
  • generator expressions
    • about / Generator expressions
    • creating / Generator expressions
  • generators
    • about / Generators
    • items, yielding from another iterable / Yield items from another iterable
    • coroutines and functions, relationship between / The relationship between coroutines, generators, and functions
  • global statement / The global and nonlocal statements
  • graphical user interface (GUI) / Running Python as a GUI application
  • graph methods / Other useful graph methods
  • graph representation
    • about / Graph representation
    • adjacency list / Adjacency list
    • adjacency matrix / Adjacency matrix
  • graphs
    • about / Graphs
    • example / Graphs
    • undirected graphs / Directed and undirected graphs
    • directed graphs / Directed and undirected graphs
    • weighted graphs / Weighted graphs
  • graph traversal
    • about / Graph traversal
    • breadth-first search / Breadth-first search
    • depth-first search / Depth-first search
  • greedy algorithms
    • about / Algorithm design paradigms
  • GUI application
    • Python, running as / Running Python as a GUI application

H

  • hash
    • elements, adding / Putting elements
    • elements, obtaining / Getting elements
    • non-string keys / Non-string keys
  • hashability / Set types
  • hashing functions / Perfect hashing functions
  • hash table
    • about / Hash table
    • testing / Testing the hash table
    • [], using with / Using [] with the hash table
    • growing / Growing a hash table
    • open addressing / Open addressing
  • heap
    • about / Heaps, Priority queues and heaps
    • item, inserting / Inserting
    • pop() operation / Pop
    • testing / Testing the heap
  • heap sort / Heap sort
  • HTTP requests
    • creating / Making HTTP requests

I

  • immutable sequences
    • about / Immutable sequences
    • strings / Strings and bytes
    • bytes / Strings and bytes
    • tuples / Tuples
  • imports
    • relative imports / Relative imports
  • in-memory stream
    • using / Using an in-memory stream
  • indexing / Indexing and slicing strings, About indexing and slicing
  • infinite iterators / Infinite iterators
  • infinite loop / The while loop
  • information hiding / Hiding details and creating the public interface
  • inheritance
    • about / Composition, Inheritance, Basic inheritance
    • abstraction / Inheritance provides abstraction
    • multiple inheritance / Multiple inheritance, Multiple inheritance
    • built-in classes, extending / Extending built-ins
    • overriding / Overriding and super
    • super function / Overriding and super
  • initializer / Objects and classes
  • input/output / IO, streams, and requests
  • input parameters
    • about / Input parameters
    • considerations / Argument passing, Assignment to argument names doesn't affect the caller, Changing a mutable affects the caller
    • specifying / How to specify input parameters
    • positional arguments / Positional arguments
    • keyword arguments / Keyword arguments and default values
    • variable positional arguments / Variable positional arguments
    • variable keyword arguments / Variable keyword arguments
    • keyword-only arguments / Keyword-only arguments
    • combining / Combining input parameters
  • insertion sort / Insertion sort
  • instance diagram / Composition
  • integer division / Integers
  • integers / Integers
  • Integrated Development Environments (IDEs) / Running the Python interactive shell, A note on IDEs
  • interfaces / Inheritance
  • interpolation search / Interpolation search
  • iterable / Iterators and iterables
  • iteration
    • versus recursion / Recursion and backtracking
  • iterators
    • about / Iterators and iterables, Iterators
    • terminating, on shortest input sequence / Iterators terminating on the shortest input sequence
    • iterator protocol / The iterator protocol
  • itertools module
    • reference / A quick peek at the itertools module

J

  • JavaScript Object Notation (JSON)
    • about / Working with JSON
    • URL / Working with JSON
    • custom encoding / Custom encoding/decoding with JSON
    • custom decoding / Custom encoding/decoding with JSON

K

  • Karatsuba algorithm
    • about / Can we do better? A recursive approach
    • Python implementation / Can we do better? A recursive approach
  • keyword-only arguments / Keyword-only arguments
  • keyword arguments / Keyword arguments and default values

L

  • lambdas / Anonymous functions
  • last in, first out (LIFO) / Stacks
  • leaf node / Terminology
  • len() function / The len() function
  • level / Terminology
  • library / How do we use modules and packages?
  • linear search
    • about / Linear Search
    • unordered linear search / Unordered linear search
    • ordered linear search / Ordered linear search
  • list-based queue
    • about / List-based queue
    • enqueue operation / Enqueue operation
    • dequeue operation / Dequeue operation
  • list comprehension / Lists
  • list comprehensions / List comprehensions
  • lists / Lists
    • size, obtaining of / Getting the size of the list
    • item, searching in / List search
    • clearing / Clearing a list
  • list search / List search
  • list traversal
    • improving / Improving list traversal
  • local, enclosing, global, built-in (LEGB) / Scopes, Scopes and name resolution
  • loop / Graphs
  • looping
    • about / Looping
    • for loop / The for loop
    • while loop / The while loop
    • break statement / The break and continue statements
    • continue statement / The break and continue statements
    • else clause / A special else clause

M

  • magic methods / Objects and classes
  • mailing list manager
    • case study / Case study
  • make_action(some, arguments) / The adapter pattern
  • manager objects
    • about / Manager objects
    • advantages / Manager objects
    • duplicate code, removing / Removing duplicate code
    • existing code, reusing / In practice
  • mapping types / Mapping types – dictionaries
  • max heap / Priority queues and heaps
  • media player queue / Media player queue
  • members / Data describes objects
  • merge sort algorithm
    • about / Runtime analysis
    • steps / Runtime analysis
    • Python code / Runtime analysis
  • metaclasses / Objects and classes
  • method overloading
    • about / An alternative to method overloading
    • alternative option / An alternative to method overloading
    • default arguments / Default arguments
    • variable argument lists / Variable argument lists
    • arguments, unpacking / Unpacking arguments
  • Method Resolution Order
    • about / The diamond problem
    • reference / The diamond problem
  • methods / A proper introduction, Behaviors are actions
  • min heap / Priority queues and heaps
  • mixin / Multiple inheritance
  • modules
    • using / How do we use modules and packages?
    • about / Modules and packages
    • organizing / Organizing modules
    • absolute imports / Absolute imports
    • relative imports / Relative imports
    • contents, organizing / Organizing module content
  • monkey patching / Using functions as attributes
  • multiple inheritance
    • about / Multiple inheritance, Multiple inheritance
    • diamond problem / The diamond problem
    • different sets of arguments, managing / Different sets of arguments
  • multiple sequences
    • iterating over / Iterating over multiple sequences
  • multiple values
    • returning / Returning multiple values
  • mutable defaults / Avoid the trap! Mutable defaults
  • mutable sequences
    • about / Mutable sequences
    • lists / Lists
    • byte arrays / Byte arrays

N

  • namedtuple / namedtuple
  • NameError exception / Scopes
  • name resolution / Scopes and name resolution
  • names / Names and namespaces, About the names
  • namespace / Names and namespaces
  • negative indexing / About indexing and slicing
  • node-based queue
    • about / Node-based queue
    • Queue class / Queue class
    • enqueue method / Enqueue operation
    • dequeue operation / Dequeue operation
  • nodes
    • about / Nodes, Terminology, Graphs
    • types / Other node types
    • deleting / Deleting nodes
  • nonlocal statements / The global and nonlocal statements
  • numbers
    • about / Numbers
    • integers / Integers
    • Booleans / Booleans
    • real numbers / Real numbers
    • complex numbers / Complex numbers
    • fractions / Fractions and decimals
    • decimal numbers / Fractions and decimals
  • NumPy
    • about / What are the drawbacks?

O

  • object-oriented analysis (OOA) / Introducing object-oriented
  • object-oriented design (OOD)
    • about / Introducing object-oriented
    • case study / Case study
  • object-oriented programming (OOP) / Introducing object-oriented
  • object-relational mapping (ORM) / Saving data to a database
  • object diagram / Composition
  • objects
    • about / A proper introduction, Objects and classes, Everything is an object, Introducing object-oriented, Objects and classes
    • mutable / A proper introduction, Mutable or immutable? That is the question
    • immutable / A proper introduction, Mutable or immutable? That is the question
    • importing / Importing objects
    • data / Data describes objects
    • identifying / Treat objects as objects
    • manager objects / Manager objects
    • case study / Case study
    • functions, using as / Functions are objects too
    • expensive objects, imitating / Imitating expensive objects
  • observer pattern
    • about / The observer pattern
    • example / An observer example
  • Omega notation / Omega notation (Ω)
  • operator overloading / Lists
  • ordered linear search / Ordered linear search

P

  • package
    • about / How is Python code organized?
    • using / How do we use modules and packages?
    / Modules and packages, Organizing modules
  • Pandas
    • about / What are the drawbacks?
  • parent / Terminology
  • path / Graphs
  • pathnames
    • manipulating / Manipulating pathnames
  • peek method, stack / Peek
  • PEP 8 / Guidelines on how to write good code
    • reference / Importing objects
  • PEP 373
    • reference / Python 2 versus Python 3
  • PEP428
    • URL / Checking for file and directory existence
  • PEP 448
    • reference / Additional unpacking generalizations
  • pickle
    • used, for data serializing / Serializing data with pickle
  • pip
    • reference / Third-party libraries
  • pointer structures
    • about / Pointer structures
    • benefits / Pointer structures
  • polymorphism / Inheritance provides abstraction, Polymorphism
  • pop operation, stack / Pop operation
  • positional arguments / Positional arguments
  • prime generator / A prime generator
  • prime number / A prime generator
  • priority queues / Priority queues and heaps
  • properties / A proper introduction
    • about / Data describes objects, Adding behaviors to class data with properties
    • behavior, adding to class data / Adding behaviors to class data with properties
    • using / Properties in detail
    • creating, with decorators / Decorators – another way to create properties
    • deciding / Deciding when to use properties
  • prunes / Backtracking
  • public interface
    • creating / Hiding details and creating the public interface
    • details, hiding / Hiding details and creating the public interface
  • push operation, stack / Push operation
  • PyPy
    • reference / What are the drawbacks?
  • pytest
    • tests, initializing / Testing with pytest
    • reference / Testing with pytest, Skipping tests with pytest
    • setting up / One way to do setup and cleanup
    • cleaning up / One way to do setup and cleanup
    • variables, setting up / A completely different way to set up variables
    • tests, skipping / Skipping tests with pytest
  • Python
    • about / Enter the Python, About Python
    • portability / Portability
    • coherence / Coherence
    • developer productivity / Developer productivity
    • extensive library / An extensive library
    • software quality / Software quality
    • software integration / Software integration
    • satisfaction / Satisfaction and enjoyment
    • drawbacks / What are the drawbacks?
    • users / Who is using Python today?
    • environment, setting up / Setting up the environment
    • installing / Installing Python
    • reference / Setting up the Python interpreter
    • running, as service / Running Python as a service
    • running, as GUI application / Running Python as a GUI application
    • execution model / Python's execution model
    • culture / The Python culture
    • decorator pattern, using / Decorators in Python
    • strategy pattern, using / Strategy in Python
  • Python 2
    • versus Python 3 / Python 2 versus Python 3
  • Python classes
    • creating / Creating Python classes
    • attributes, adding / Adding attributes
    • behaviors, adding / Making it do something
    • self argument, adding / Talking to yourself
    • multiple arguments, adding / More arguments
    • object, initializing / Initializing the object
    • documentation / Explaining yourself
  • Python code
    • organizing / How is Python code organized?
  • Pythonic / The Python culture
  • Python interactive shell
    • running / Running the Python interactive shell
  • Python interpreter
    • setting up / Setting up the Python interpreter
  • Python Package Index (PyPI) / An extensive library
    • about / Third-party libraries
    • reference / Third-party libraries
  • Python program
    • running / How you can run a Python program
  • Python scripts
    • running / Running Python scripts
  • Python Tutor
    • reference / Everything is an object

Q

  • queues
    • about / Queues
    • working / Queues
    • list-based queue / List-based queue
    • stack-based queue / Stack-based queue
    • node-based queue / Node-based queue
    • applications / Application of queues
    • media player queue / Media player queue
  • quick select algorithm
    • about / Quick select
    • partition step / Partition step
  • quick sort
    • list partitioning / List partitioning
    • implementation / Implementation
  • quick sort algorithm / Quick sort

R

  • randomized selection
    • about / Randomized selection
    • quick select algorithm / Quick select
  • range
    • iterating over / Iterating over a range
  • real numbers / Real numbers
  • recursion
    • about / Recursion and backtracking
    • versus iteration / Recursion and backtracking
  • recursion tree
    • advantage, of analyzing algorithms / Runtime analysis
  • recursive approach / Can we do better? A recursive approach
  • recursive functions / Recursive functions
  • relational algebra / Saving data to a database
  • relational model / Saving data to a database
  • relative imports
    • about / Relative imports
    • reference / Relative imports
    / Relative imports
  • requests / IO, streams, and requests
  • return values / Return values
  • reversed() function / Reversed
  • reverse polish expression
    • parsing / Parsing a reverse Polish expression
  • reverse polish notation (RPN) / Post-order traversal and postfix notation.
  • root node / Terminology
  • RSA algorithm
    • reference / Case study
  • runtime analysis / Runtime analysis

S

  • scopes
    • about / Scopes, Scopes and name resolution
    • local scope / Scopes
    • enclosing scope / Scopes
    • global scope / Scopes
    • built-in scope / Scopes
    • example / Scopes
  • search algorithm
    • selecting / Choosing a search algorithm
  • search term / Unordered linear search
  • selection algorithms / Selection algorithms
  • selection by sorting / Selection by sorting
  • selection sort / Selection sort
  • sequence
    • iterating over / Iterating over a sequence
  • service
    • Python, running as / Running Python as a service
  • set comprehensions / Set and dictionary comprehensions
  • set types / Set types
  • shelve
    • used, for saving data / Saving data with shelve
  • siblings / Terminology
  • Simple Mail Transfer Protocol (SMTP) server / Case study
  • singleton implementation / Singleton implementation
  • singleton pattern
    • about / The singleton pattern
    • mimicking, with module variables / Module variables can mimic singletons
  • singly linked list class / Singly linked list class
  • singly linked lists
    • about / Singly linked lists
    • append operation / Append operation
  • size
    • obtaining, of list / Getting the size of the list
  • slicing / Indexing and slicing strings, About indexing and slicing
  • small values caching / Small values caching
  • sorting algorithms
    • about / Sorting algorithms
    • bubble sort / Bubble sort
    • insertion sort / Insertion sort
    • selection sort / Selection sort
    • quick sort / Quick sort
  • specialization / Case study
  • stack-based queue
    • about / Stack-based queue
    • enqueue operation / Enqueue operation
    • dequeue operation / Dequeue operation
  • stacks
    • about / Stacks
    • operations / Stacks
    • usage / Stacks
    • implementing / Stack implementation
    • push operation / Push operation
    • pop operation / Pop operation
    • peek method / Peek
    • bracket-matching application / Bracket-matching application
  • state pattern
    • about / The state pattern
    • example / A state example
    • versus strategy pattern / State versus strategy
    • as coroutine solution / State transition as coroutines
  • strategy pattern
    • about / The strategy pattern
    • example / A strategy example
    • using, in Python / Strategy in Python
    • versus state pattern / State versus strategy
  • streams / IO, streams, and requests
  • strings
    • about / Strings and bytes
    • encoding / Encoding and decoding strings
    • decoding / Encoding and decoding strings
    • formatting / String formatting
  • Structured Query Language (SQL) / Saving data to a database
  • student grader system
    • case study / Case study
  • sub tree / Terminology
  • superclass / Basic inheritance
  • symbol tables / Symbol tables
  • syntactic sugar / Extending built-ins

T

  • template pattern
    • about / The template pattern
    • example / A template example
  • temporary directories / Temporary files and directories
  • temporary files / Temporary files and directories
  • ternary operator / The ternary operator
  • tests
    • need for / Why test?
    • test-driven development / Test-driven development
    • unit tests / Unit testing
    • initializing, with pytest / Testing with pytest
    • skipping, with pytest / Skipping tests with pytest
    • code coverage, verifying / How much testing is enough?
    • case study / Case study
    • implementing / Implementing it
  • Theta notation / Theta notation (ϴ)
  • third-party libraries / Third-party libraries
  • tight lower bound / Omega notation (Ω)
  • tight upper bound / Big O notation
  • time complexity / Big O notation
  • Timsort / Lists
  • tree nodes / Tree nodes
  • trees
    • balancing / Balancing trees
  • tree traversal
    • about / Tree traversal
    • depth first traversal / Depth-first traversal
  • true division / Integers
  • tuples / Tuples

U

  • undirected graph / Directed and undirected graphs
  • Unicode code points / Strings and bytes
  • Unified Modeling Language (UML) / Objects and classes
  • unit tests
    • about / Unit testing
    • assertion methods / Assertion methods
    • boilerplate, reducing / Reducing boilerplate and cleaning up
    • cleaning up / Reducing boilerplate and cleaning up
    • organizing / Organizing and running tests
    • executing / Organizing and running tests
    • broken tests, ignoring / Ignoring broken tests
  • unordered linear search / Unordered linear search
  • unpacking / Variable positional arguments
  • upcasting / Booleans
  • UTF-8 encoding / Encoding and decoding strings

V

  • variable argument lists / Variable argument lists
  • variable keyword arguments / Variable keyword arguments
  • variable positional arguments / Variable positional arguments
  • variadic arguments (varargs) / Variable argument lists
  • vertex / Graphs
  • virtual environment (virtualenv)
    • about / About virtualenv
    • reference / About virtualenv
    • creating / Your first virtual environment

W

  • weighted graph / Weighted graphs
  • weighted graphs / Weighted graphs
  • while loop / The while loop
  • worst case analysis / Runtime analysis