I
- -i command-line argument, Which Option Should I Use?
- __iadd__ method, Common Operator Overloading Methods, Right-Side and In-Place Uses: __radd__ and __iadd__–In-Place Addition, bytearrays in Action
- icon clicks, Icon-Click Basics, Clicking Icons on Windows–The input Trick on Windows, The input Trick on Windows–Other Icon-Click Limitations
-
- about, Icon-Click Basics
- limitations, The input Trick on Windows–Other Icon-Click Limitations
- Windows platform, Clicking Icons on Windows–The input Trick on Windows
- id built-in function, Listing instance attributes with __dict__
- IDEs (integrated development environments), The IDLE User Interface, Other IDEs–Other IDEs, Development Tools for Larger Projects
-
- about, The IDLE User Interface, Development Tools for Larger Projects
- alternative, Other IDEs–Other IDEs
- IDLE user interface, Usage Notes: Command Lines and Files, The IDLE User Interface, IDLE Startup Details, IDLE Basic Usage–IDLE Basic Usage, IDLE Usability Features, Advanced IDLE Tools, Usage Notes: IDLE–Usage Notes: IDLE, Triple Quotes Code Multiline Block Strings, The dir Function, Python Environment Variables
-
- about, The IDLE User Interface, The dir Function, Python Environment Variables
- advanced tools, Advanced IDLE Tools
- basic usage, IDLE Basic Usage–IDLE Basic Usage
- common usage mistakes, Usage Notes: Command Lines and Files, Usage Notes: IDLE–Usage Notes: IDLE
- multiline block strings, Triple Quotes Code Multiline Block Strings
- startup details, IDLE Startup Details
- usability features, IDLE Usability Features
- if (elif/else) statement, Entering multiline statements, Missing Keys: if Tests–Missing Keys: if Tests, Python’s Statements, A Tale of Two ifs, A Simple Interactive Loop, Handling Errors by Testing Inputs, if Statements, General Format, Basic Examples, Multiway Branching–Handling larger actions, Test Your Knowledge: Quiz, Filter clauses: if, Multiway branch switches: The finale
-
- about, Python’s Statements, A Tale of Two ifs, if Statements
- basic examples, Basic Examples
- filter clauses, Filter clauses: if
- general format, General Format
- interactive loops example, A Simple Interactive Loop, Handling Errors by Testing Inputs
- missing keys tests, Missing Keys: if Tests–Missing Keys: if Tests
- multiway branching, Multiway Branching–Handling larger actions, Multiway branch switches: The finale
- quiz questions and answers, Test Your Knowledge: Quiz
- terminating, Entering multiline statements
- if/else ternary expression, Python Expression Operators, The if/else Ternary Expression–The if/else Ternary Expression
- immutable objects, Immutability, Immutable constraints and frozen sets, String Basics, Changing Strings I, Core Types Review and Summary, Immutable Types Can’t Be Changed in Place
-
- about, Immutability, Changing Strings I
- changing in place, Core Types Review and Summary, Immutable Types Can’t Be Changed in Place
- constraints with, Immutable constraints and frozen sets
- immutable sequences, String Basics
- imp.reload function, Import and Reload Basics–The Grander Module Story: Attributes, Usage Notes: import and reload, Usage Notes: IDLE, Modules: The Big Picture
- implementation-related object types, Python’s Core Data Types
- implicit assignments, Changing mutables in modules
- __import__ built-in function, Import hooks and ZIP files, Direct Calls: Two Options
- import statement, Import and Reload Basics–The Grander Module Story: Attributes, Usage Notes: import and reload, Usage Notes: IDLE, Python’s Statements, Modules: The Big Picture, Imports and Attributes–Imports and Attributes, How Imports Work–3. Run It, The import Statement, Imports Happen Only Once, import and from Are Assignments, import and from Equivalence, Potential Pitfalls of the from Statement–When import is required, Imports Versus Scopes, Package Import Basics, Package Import Basics, Packages and Search Path Settings, from Versus import with Packages, The as Extension for import and from, Importing Modules by Name String–Direct Calls: Two Options, Recursive from Imports May Not Work, with/as Context Managers
-
- (see also package imports)
- about, Import and Reload Basics–The Grander Module Story: Attributes, Python’s Statements, Modules: The Big Picture, Imports and Attributes–Imports and Attributes, The import Statement
- as extension, The as Extension for import and from
- as one-time occurrence, Imports Happen Only Once
- common usage mistakes, Usage Notes: import and reload, Usage Notes: IDLE
- dot path syntax, Packages and Search Path Settings
- enabling context managers, with/as Context Managers
- as executable statement, import and from Are Assignments
- from statement versus, import and from Equivalence, from Versus import with Packages, Recursive from Imports May Not Work
- importing modules by name string, Importing Modules by Name String–Direct Calls: Two Options
- packages and, Package Import Basics
- potential pitfalls, Potential Pitfalls of the from Statement–When import is required
- process overview, How Imports Work–3. Run It
- scopes versus, Imports Versus Scopes
- import this command, Software Quality, Don’t Abuse List Comprehensions: KISS
- importlib.import_module function, Import hooks and ZIP files, Direct Calls: Two Options
- in operator, Missing Keys: if Tests, Other Core Types, Other Common String Methods in Action, Basic Dictionary Operations
-
- dictionaries and, Missing Keys: if Tests, Basic Dictionary Operations
- sets and, Other Core Types
- strings and, Other Common String Methods in Action
- in-place change operations, Shared References and In-Place Changes–Shared References and In-Place Changes, Changing Lists in Place–Other common list operations, Changing Dictionaries in Place, Core Types Review and Summary, Immutable Types Can’t Be Changed in Place, Expression Statements and In-Place Changes, Expression Statements and In-Place Changes, Scope Details, Avoiding Mutable Argument Changes
-
- avoiding mutable argument changes, Avoiding Mutable Argument Changes
- dictionaries and, Changing Dictionaries in Place
- expression statements and, Expression Statements and In-Place Changes
- immutable objects and, Core Types Review and Summary, Immutable Types Can’t Be Changed in Place
- lists and, Changing Lists in Place–Other common list operations, Expression Statements and In-Place Changes
- scope and, Scope Details
- shared references and, Shared References and In-Place Changes–Shared References and In-Place Changes
- indenting, Usage Notes: The Interactive Prompt, End of indentation is end of block–Why Indentation Syntax?, Block Delimiters: Indentation Rules–Avoid mixing tabs and spaces: New error checking in 3.X
-
- blocks of code, Block Delimiters: Indentation Rules–Avoid mixing tabs and spaces: New error checking in 3.X
- common usage mistakes, Usage Notes: The Interactive Prompt
- statements, End of indentation is end of block–Why Indentation Syntax?
- __index__ method, Common Operator Overloading Methods, But 3.X’s __index__ Is Not Indexing!
- IndexError exception, Iterable Objects: __iter__ and __next__, Default Exception Handler, Raising Exceptions
- indexing, Sequence Operations, Mapping Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects, Indexing, Slicing, and Matrixes, Index and slice assignments–Index and slice assignments, Dictionaries, Dictionary Usage Notes, Tuples, Indexing and Slicing: __getitem__ and __setitem__–But 3.X’s __index__ Is Not Indexing!
-
- dictionaries, Mapping Operations, Dictionaries, Dictionary Usage Notes
- lists, Indexing, Slicing, and Matrixes, Index and slice assignments–Index and slice assignments
- operator overloading and, Indexing and Slicing: __getitem__ and __setitem__–But 3.X’s __index__ Is Not Indexing!
- strings, Sequence Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects
- tuples, Tuples
- indirect function calls, Indirect Function Calls: “First Class” Objects
- inheritance, OOP: The Big Picture–OOP from 30,000 Feet, Attribute Inheritance Search–Attribute Inheritance Search, Coding Class Trees, Instance Objects Are Concrete Items, Classes Are Customized by Inheritance–Classes Are Attributes in Modules, Classes Are Customized by Inheritance, Classes Are Customized by Inheritance, A Second Example, A Third Example, Inheritance, Inheritance, Attribute Tree Construction, Attribute Tree Construction, Attribute Tree Construction, Specializing Inherited Methods, Class Interface Techniques–Class Interface Techniques, Abstract Superclasses–Abstract superclasses in Python 3.X and 2.6+: Preview, Python and OOP, OOP and Inheritance: “Is-a” Relationships–OOP and Inheritance: “Is-a” Relationships, Multiple Inheritance: “Mix-in” Classes–Room for improvement: MRO, slots, GUIs, Multiple Inheritance: “Mix-in” Classes, Listing inherited attributes with dir–Listing inherited attributes with dir, Example: Mapping Attributes to Inheritance Sources–Example: Mapping Attributes to Inheritance Sources, Inheritance versus delegation, Inheritance and Instance–The built-ins special case, Inheritance and Instance, Inheritance: The Full Story–The built-ins special case, The descriptors special case–Assignment inheritance, Assignment inheritance, The built-ins special case
-
- (see also multiple inheritance)
- about, OOP: The Big Picture–OOP from 30,000 Feet, Inheritance, Python and OOP
- abstract superclasses, Abstract Superclasses–Abstract superclasses in Python 3.X and 2.6+: Preview
- assignment and, Assignment inheritance
- attribute tree construction, Attribute Tree Construction
- attributes and, Attribute Inheritance Search–Attribute Inheritance Search, Classes Are Customized by Inheritance, Listing inherited attributes with dir–Listing inherited attributes with dir
- built-ins and, The built-ins special case
- class interface techniques, Class Interface Techniques–Class Interface Techniques
- classes and, Classes Are Customized by Inheritance–Classes Are Attributes in Modules, Classes Are Customized by Inheritance, Multiple Inheritance: “Mix-in” Classes–Room for improvement: MRO, slots, GUIs
- delegation versus, Inheritance versus delegation
- descriptors and, Attribute Tree Construction, The descriptors special case–Assignment inheritance
- formal definition and algorithm, Inheritance: The Full Story–The built-ins special case
- instances and, Instance Objects Are Concrete Items
- mapping attributes to sources, Example: Mapping Attributes to Inheritance Sources–Example: Mapping Attributes to Inheritance Sources
- metaclasses and, Attribute Tree Construction, Inheritance and Instance–The built-ins special case
- multiple, Coding Class Trees
- namespaces and, Inheritance
- OOP considerations, OOP and Inheritance: “Is-a” Relationships–OOP and Inheritance: “Is-a” Relationships
- specializing inherited methods, Specializing Inherited Methods
- subclasses and, A Third Example
- type object and, Inheritance and Instance
- usage examples, A Second Example
- __init__ method, Operator Overloading, A Third Example, Coding Constructors, Calling Superclass Constructors, Calling Superclass Constructors, Constructors and Expressions: __init__ and __sub__, Common Operator Overloading Methods, Using Properties to Validate, Implementation, Class Blunders II: Retaining Multiple Instances, A Basic Metaclass
-
- about, Operator Overloading, Common Operator Overloading Methods
- attribute validation and, Using Properties to Validate
- class decorators and, Implementation, Class Blunders II: Retaining Multiple Instances
- coding multiple, Calling Superclass Constructors
- constructors and, Coding Constructors, Calling Superclass Constructors, Constructors and Expressions: __init__ and __sub__
- inheritance and, A Third Example
- metaclasses and, A Basic Metaclass
- __init__.py files, Package __init__.py Files–Package initialization file roles, Namespace Package Semantics–Impacts on Regular Packages: Optional __init__.py
- input built-in function, The input Trick on Windows, The input Trick on Windows, A Simple Interactive Loop, Example: Dual Mode Code
-
- input trick on Windows, The input Trick on Windows, The input Trick on Windows
- prompting for test inputs, Example: Dual Mode Code
- usage example, A Simple Interactive Loop
- installing Python, Introducing the Python Interpreter, Installing the Python Interpreter–Installation Steps
- instance attributes, Instance Versus Class Attributes, Instance Versus Class Attributes, Attribute Tree Construction, Namespace Dictionaries: Review, Emulating Privacy for Instance Attributes: Part 1, Listing instance attributes with __dict__–Listing instance attributes with __dict__, Class instance attributes
-
- class attributes versus, Instance Versus Class Attributes
- creating, Attribute Tree Construction
- emulating privacy for, Emulating Privacy for Instance Attributes: Part 1
- function decorators and, Class instance attributes
- listing with __dict__, Listing instance attributes with __dict__–Listing instance attributes with __dict__
- usage examples, Namespace Dictionaries: Review
- instance methods, Other Method Call Possibilities
- instances, Why Use Classes?, Classes and Instances, Classes Generate Multiple Instance Objects–A First Example, Instance Objects Are Concrete Items, Instance Objects Are Concrete Items, Instance Objects Are Concrete Items, Instance Objects Are Concrete Items, A First Example–A First Example, Step 1: Making Instances–Using Code Two Ways, Counting Instances with Static Methods, Counting Instances with Class Methods–Counting instances per class with class methods, Coding Exceptions Classes, Managing Calls and Instances, Supporting multiple instances, Class Blunders II: Retaining Multiple Instances, Classes Are Instances of type–Classes Are Instances of type, Inheritance and Instance–The built-ins special case, Managing instances instead of classes–Managing instances instead of classes
-
- about, Why Use Classes?, Instance Objects Are Concrete Items
- about and, Classes and Instances
- counting with class methods, Counting Instances with Class Methods–Counting instances per class with class methods
- counting with static methods, Counting Instances with Static Methods
- creating, Instance Objects Are Concrete Items, Step 1: Making Instances–Using Code Two Ways
- decorators managing, Managing Calls and Instances
- inheritance and, Instance Objects Are Concrete Items
- metaclasses and, Inheritance and Instance–The built-ins special case, Managing instances instead of classes–Managing instances instead of classes
- multiple, Classes Generate Multiple Instance Objects–A First Example, Supporting multiple instances, Class Blunders II: Retaining Multiple Instances
- namespaces and, Instance Objects Are Concrete Items
- raising with raise statement, Coding Exceptions Classes
- type object and, Classes Are Instances of type–Classes Are Instances of type
- usage examples, A First Example–A First Example
- int built-in function, Hex, Octal, Binary: Literals and Conversions, String Conversion Tools, Character code conversions, Type Objects, Handling Errors by Testing Inputs
-
- about, Hex, Octal, Binary: Literals and Conversions, String Conversion Tools, Type Objects
- alternatives to, Character code conversions
- interactive loops example, Handling Errors by Testing Inputs
- integers (int type), Numbers, Numeric Literals, Numeric Literals, Integer Precision, Hex, Octal, Binary: Literals and Conversions–Hex, Octal, Binary: Literals and Conversions, Hex, Octal, Binary: Literals and Conversions, Bitwise Operations, Using dictionaries to simulate flexible lists: Integer keys
-
- about, Numbers, Numeric Literals
- bit_length method, Bitwise Operations
- converting to strings, Hex, Octal, Binary: Literals and Conversions
- hex, octal, binary notation, Numeric Literals, Hex, Octal, Binary: Literals and Conversions–Hex, Octal, Binary: Literals and Conversions
- integer keys, Using dictionaries to simulate flexible lists: Integer keys
- precision in, Integer Precision
- integrated development environments (IDEs), The IDLE User Interface, Other IDEs–Other IDEs, Development Tools for Larger Projects
-
- about, The IDLE User Interface, Development Tools for Larger Projects
- alternative, Other IDEs–Other IDEs
- interactive loops, A Quick Example: Interactive Loops–Nesting Code Three Levels Deep
- interactive prompt, Byte code compilation, The Interactive Prompt, Starting an Interactive Session, The System Path, New Windows Options in 3.3: PATH, Launcher, Where to Run: Code Directories, What Not to Type: Prompts and Comments, Running Code Interactively, Experimenting, Testing, Usage Notes: The Interactive Prompt–Entering multiline statements, Entering multiline statements, Expression Statements, Scope Details, Testing recursive reloads, Catching Exceptions
-
- about, Byte code compilation, The Interactive Prompt
- code directories, Where to Run: Code Directories
- common usage mistakes, Usage Notes: The Interactive Prompt–Entering multiline statements
- exception handling and, Catching Exceptions
- as experimenting tool, Experimenting
- new Windows options, New Windows Options in 3.3: PATH, Launcher
- printing values at, Expression Statements
- prompts and comments and, What Not to Type: Prompts and Comments
- recursive reload example, Testing recursive reloads
- running code interactively, Running Code Interactively
- scope and, Scope Details
- starting interactive sessions, Starting an Interactive Session
- system path, The System Path
- terminating compound statements, Entering multiline statements
- as testing tool, Testing
- Internet scripting, Internet Scripting
- interpreters, Introducing the Python Interpreter (see Python interpreter)
- introspection tools, Function Introspection, Step 6: Using Introspection Tools–Our Classes’ Final Form, Function introspection
-
- classes, Step 6: Using Introspection Tools–Our Classes’ Final Form
- functions, Function Introspection, Function introspection
- iOS platform, Installation Steps
- IronPython system, Python Implementation Alternatives, IronPython: Python for .NET
- is operator, Python Expression Operators, Comparisons, Equality, and Truth
- isinstance built-in function, Type Objects, Propagating class type, Listing inherited attributes with dir
- iter built-in function, Iteration and Optimization, Manual Iteration: iter and next–Manual iteration, Multiple Versus Single Pass Iterators, Preview: User-defined iterables in classes
-
- about, Iteration and Optimization, Manual Iteration: iter and next–Manual iteration, Multiple Versus Single Pass Iterators
- user defined iterables and, Preview: User-defined iterables in classes
- __iter__ method, Other Iteration Topics, Preview: User-defined iterables in classes, Common Operator Overloading Methods, Iterable Objects: __iter__ and __next__–Multiple iterators with yield, Coding Alternative: __iter__ plus yield–Multiple iterators with yield, Membership: __contains__, __iter__, and __getitem__–Membership: __contains__, __iter__, and __getitem__
-
- about, Preview: User-defined iterables in classes, Common Operator Overloading Methods
- coding example, Coding Alternative: __iter__ plus yield–Multiple iterators with yield
- iterable objects and, Iterable Objects: __iter__ and __next__–Multiple iterators with yield
- membership and, Membership: __contains__, __iter__, and __getitem__–Membership: __contains__, __iter__, and __getitem__
- user defined classes and, Other Iteration Topics
- iteration, Iteration and Optimization, Iteration and Optimization, Iteration and Optimization, List Iteration and Comprehensions, Basic Dictionary Operations, Tuples, Files in Action, Loop Coding Techniques–Generating Both Offsets and Items: enumerate, Iterations: A First Look–Other Built-in Type Iterables, Iterations: A First Look, The Iteration Protocol: File Iterators–The Iteration Protocol: File Iterators, The Iteration Protocol: File Iterators, Manual Iteration: iter and next–Manual iteration, Other Built-in Type Iterables–Other Built-in Type Iterables, Other Built-in Type Iterables, Other Iteration Contexts–Other Iteration Contexts, Other Iteration Contexts, New Iterables in Python 3.X–Dictionary View Iterables, New Iterables in Python 3.X, The map, zip, and filter Iterables, Multiple Versus Single Pass Iterators, Multiple Versus Single Pass Iterators, Dictionary View Iterables–Dictionary View Iterables, Other Iteration Topics, Other Iteration Topics, Test Your Knowledge: Quiz, Mapping Functions over Iterables: map–Mapping Functions over Iterables: map, On the other hand: performance, conciseness, expressiveness, Iteration protocol integration, Generator Expressions: Iterables Meet Comprehensions–Generator expressions versus filter, Generators Are Single-Iteration Objects–Generators Are Single-Iteration Objects, Example: Emulating zip and map with Iteration Tools–Coding your own zip(...) and map(None, ...), Example: Emulating zip and map with Iteration Tools–Coding your own zip(...) and map(None, ...), Coding your own zip(...) and map(None, ...), Timing Iteration Alternatives–Room for improvement: Setup, Index Iteration: __getitem__–Multiple iterators with yield
-
- about, Iteration and Optimization, Iterations: A First Look
- additional contexts, Other Iteration Contexts–Other Iteration Contexts
- additional information, Other Iteration Topics
- built-in functions and, Other Iteration Contexts, New Iterables in Python 3.X, The map, zip, and filter Iterables, Mapping Functions over Iterables: map–Mapping Functions over Iterables: map, Example: Emulating zip and map with Iteration Tools–Coding your own zip(...) and map(None, ...)
- built-in types supported, Other Built-in Type Iterables–Other Built-in Type Iterables
- comprehensions versus, Generator Expressions: Iterables Meet Comprehensions–Generator expressions versus filter
- in dictionaries, Iteration and Optimization, Basic Dictionary Operations, Other Built-in Type Iterables, Dictionary View Iterables–Dictionary View Iterables
- in files, Files in Action, The Iteration Protocol: File Iterators–The Iteration Protocol: File Iterators, On the other hand: performance, conciseness, expressiveness
- generators and, Iteration and Optimization, Multiple Versus Single Pass Iterators, Other Iteration Topics, Iteration protocol integration, Generators Are Single-Iteration Objects–Generators Are Single-Iteration Objects, Example: Emulating zip and map with Iteration Tools–Coding your own zip(...) and map(None, ...)
- in lists, List Iteration and Comprehensions
- loop coding techniques, Loop Coding Techniques–Generating Both Offsets and Items: enumerate, Iterations: A First Look–Other Built-in Type Iterables
- manual, Manual Iteration: iter and next–Manual iteration
- multiple versus single pass, Multiple Versus Single Pass Iterators
- one-shot, Coding your own zip(...) and map(None, ...)
- operator overloading and, Index Iteration: __getitem__–Multiple iterators with yield
- quiz questions and answers, Test Your Knowledge: Quiz
- timing iteration alternatives, Timing Iteration Alternatives–Room for improvement: Setup
- in tuples, Tuples
- version considerations, The Iteration Protocol: File Iterators, New Iterables in Python 3.X–Dictionary View Iterables