S
- SAX parsing, XML Parsing Tools
- ScientificPython programming extension, Numeric and Scientific Programming
- SciPy programming extension, Numeric and Scientific Programming, Nesting
- scopes, Python’s Statements, Python’s Statements, Coding Functions, Coding Functions, Python Scope Basics–Scope Details, Scope Details, Scope Details, Name Resolution: The LEGB Rule–Other Python scopes: Preview, Name Resolution: The LEGB Rule, Scope Example, The Built-in Scope–Redefining built-in names: For better or worse, The Built-in Scope, The global Statement, The global Statement, Program Design: Minimize Global Variables, Program Design: Minimize Cross-File Changes–Program Design: Minimize Cross-File Changes, Other Ways to Access Globals, Scopes and Nested Functions–Arbitrary scope nesting, The nonlocal Statement in 3.X–State with mutables: Obscure ghost of Pythons past?, nonlocal Basics, Test Your Knowledge: Quiz–Test Your Knowledge: Answers, Scopes: lambdas Can Be Nested Too, Scopes and Comprehension Variables, Enclosing scopes and loop variables: Factory functions, Files Generate Namespaces, Imports Versus Scopes, The Scope of Relative Imports, Simple Names: Global Unless Assigned, Nested Classes: The LEGB Scopes Rule Revisited–Nested Classes: The LEGB Scopes Rule Revisited, Scopes in Methods and Classes, Scopes and try except Variables
-
- about, Python Scope Basics–Scope Details
- accessing global variables, Other Ways to Access Globals
- builtins module, The Built-in Scope–Redefining built-in names: For better or worse
- comprehension variables and, Scopes and Comprehension Variables
- function-related gotchas, Enclosing scopes and loop variables: Factory functions
- global statement, Python’s Statements, Coding Functions, Scope Details, The global Statement, nonlocal Basics
- imports versus, Imports Versus Scopes
- LEGB rule and, Name Resolution: The LEGB Rule, The Built-in Scope, Simple Names: Global Unless Assigned, Nested Classes: The LEGB Scopes Rule Revisited–Nested Classes: The LEGB Scopes Rule Revisited
- in methods and classes, Scopes in Methods and Classes
- minimizing cross-file changes, Program Design: Minimize Cross-File Changes–Program Design: Minimize Cross-File Changes
- minimizing global variables, Program Design: Minimize Global Variables
- modules and, Files Generate Namespaces
- name resolution and, Name Resolution: The LEGB Rule–Other Python scopes: Preview
- nested functions and, Scopes and Nested Functions–Arbitrary scope nesting, Scopes: lambdas Can Be Nested Too
- nonlocal statement, Python’s Statements, Coding Functions, Scope Details, The global Statement, The nonlocal Statement in 3.X–State with mutables: Obscure ghost of Pythons past?
- quiz questions and answers, Test Your Knowledge: Quiz–Test Your Knowledge: Answers
- relative imports model, The Scope of Relative Imports
- try/except statement and, Scopes and try except Variables
- usage example, Scope Example
- screen scraping technique, Future Directions
- scripts and scripting, Is Python a “Scripting Language”?, Internet Scripting, It’s Object-Oriented and Functional, Entering multiline statements, System Command Lines and Files, A First Script, Unix-Style Executable Scripts: #!–The Python 3.3 Windows Launcher: #! Comes to Windows, Clicking File Icons–Other Icon-Click Limitations, Other Icon-Click Limitations, Usage Notes: IDLE, Timing Script, Command-line usage, Benchmark Module and Script: timeit–Benchmark Script Results, Running script files with arguments
-
- about, Is Python a “Scripting Language”?
- common usage mistakes, Usage Notes: IDLE
- error handling, Other Icon-Click Limitations
- executable, Unix-Style Executable Scripts: #!–The Python 3.3 Windows Launcher: #! Comes to Windows
- Internet, Internet Scripting
- launching scripts with icon clicks, Clicking File Icons–Other Icon-Click Limitations
- modules and, System Command Lines and Files
- Python support, It’s Object-Oriented and Functional
- running with arguments, Running script files with arguments
- terminating compound statements, Entering multiline statements
- timeit module and, Command-line usage, Benchmark Module and Script: timeit–Benchmark Script Results
- timing script, Timing Script
- writing scripts, A First Script
- search path, Usage Notes: import and reload, The Module Search Path–Optimized byte code files, Packages and Search Path Settings, Relative Import Basics, Changing the Module Search Path–Changing the Module Search Path, Path files, Running modules on the search path
-
- modules, Usage Notes: import and reload, The Module Search Path–Optimized byte code files, Changing the Module Search Path–Changing the Module Search Path, Path files, Running modules on the search path
- packages, Packages and Search Path Settings, Relative Import Basics
- selection as programming pillar, The Python Conceptual Hierarchy
- self argument, Function Design Concepts, Scopes: lambdas Can Be Nested Too, The World’s Simplest Python Class, Coding Constructors, Methods, Why the Special Methods?
-
- about, Function Design Concepts, Methods
- coding constructors, Coding Constructors
- lambda callbacks and, Scopes: lambdas Can Be Nested Too
- static methods and, Why the Special Methods?
- usage considerations, The World’s Simplest Python Class
- semicolon (;), End-of-line is end of statement, Statement rule special cases
- sentinel value, Functions Can Signal Conditions with raise
- sequence assignments, Assignment Statement Forms–Sequence Assignments, Advanced sequence assignment patterns–Advanced sequence assignment patterns
-
- about, Assignment Statement Forms–Sequence Assignments
- advanced patterns, Advanced sequence assignment patterns–Advanced sequence assignment patterns
- sequence operations, Numbers, Sequence Operations–Sequence Operations, Sequence Operations, Dictionary Usage Notes, Python Syntax Revisited, Sequence Scans: while and range Versus for–Sequence Shufflers: range and len, Impacts on 2.X Code: Pros and Cons, Example: Generating Scrambled Sequences–Permutations: All possible combinations, Sequence Operations
-
- bytes string type, Sequence Operations
- dictionaries and, Dictionary Usage Notes
- generating scrambled sequences, Example: Generating Scrambled Sequences–Permutations: All possible combinations
- iteration and, Impacts on 2.X Code: Pros and Cons
- lists, Sequence Operations
- loop coding techniques, Sequence Scans: while and range Versus for–Sequence Shufflers: range and len
- numbers, Numbers
- statement execution, Python Syntax Revisited
- strings, Sequence Operations–Sequence Operations
- sequences, The Python Conceptual Hierarchy, Strings, Strings, Other Ways to Code Strings, Lists, Tuples, String Basics, Escape Sequences Represent Special Characters–Raw Strings Suppress Escapes, Indexing, Slicing, and Matrixes, Repetition Adds One Level Deep, A Second Example: Intersecting Sequences–Local Variables, Generalized Set Functions–Generalized Set Functions
-
- about, Strings
- escape, Other Ways to Code Strings, String Basics, Escape Sequences Represent Special Characters–Raw Strings Suppress Escapes
- intersecting, A Second Example: Intersecting Sequences–Local Variables, Generalized Set Functions–Generalized Set Functions
- list, Lists, Indexing, Slicing, and Matrixes
- as programming pillar, The Python Conceptual Hierarchy
- repeating, Repetition Adds One Level Deep
- string, Strings
- tuple, Tuples
- server connections, closing, Closing Files and Server Connections
- set built-in function, Other Core Types, Set literals in Python 3.X and 2.7, Type Objects
- set comprehensions, Set literals in Python 3.X and 2.7, Set comprehensions in Python 3.X and 2.7, Other Iteration Contexts, Comprehending Set and Dictionary Comprehensions–Extended Comprehension Syntax for Sets and Dictionaries
- __set__ method, Common Operator Overloading Methods, Other Attribute Management Tools, The Basics, Using descriptors to decorate methods
-
- about, Common Operator Overloading Methods
- descriptors and, Other Attribute Management Tools, Using descriptors to decorate methods
- managing attributes, The Basics
- set notation, Comprehensions
- setattr built-in function, How (Not) to Obfuscate Your Python Code
- __setattr__ method, More recursion examples, Example, Common Operator Overloading Methods, Attribute Access: __getattr__ and __setattr__–Emulating Privacy for Instance Attributes: Part 1, Pseudoprivate Class Attributes, Inserting Code to Run on Attribute Access, __getattr__ and __getattribute__, Using __dict__ and __slots__ (and other virtual names)
-
- about, Common Operator Overloading Methods, Attribute Access: __getattr__ and __setattr__–Emulating Privacy for Instance Attributes: Part 1, Inserting Code to Run on Attribute Access, __getattr__ and __getattribute__
- attribute assignments and, Example
- emulating privacy, Pseudoprivate Class Attributes
- private attributes and, Using __dict__ and __slots__ (and other virtual names)
- recursive looping and, More recursion examples
- __setitem__ method, Common Operator Overloading Methods, Indexing and Slicing: __getitem__ and __setitem__–But 3.X’s __index__ Is Not Indexing!, bytearrays in Action
- sets, Python’s Core Data Types, Numbers, Other Core Types, Other Core Types, Sets, Set basics in Python 2.6 and earlier–Set comprehensions in Python 3.X and 2.7, Set literals in Python 3.X and 2.7, Immutable constraints and frozen sets, Immutable constraints and frozen sets, Why sets?–Why sets?, Dictionary views and sets, References Versus Copies, Comparisons, Equality, and Truth, Generalized Set Functions
-
- about, Numbers, Other Core Types, Sets, Why sets?–Why sets?, Generalized Set Functions
- comparison operations, Comparisons, Equality, and Truth
- copy method, References Versus Copies
- creating, Other Core Types
- dictionary views and, Dictionary views and sets
- frozen, Immutable constraints and frozen sets
- immutable constraints, Immutable constraints and frozen sets
- literals, Python’s Core Data Types, Set literals in Python 3.X and 2.7
- version considerations, Set basics in Python 2.6 and earlier–Set comprehensions in Python 3.X and 2.7
- __setslice__ method, Slicing and Indexing in Python 2.X
- shadowing, Hiding built-ins by assignment: Shadowing
- shared references, Shared References–Shared References, Shared References and In-Place Changes–Shared References and In-Place Changes, Shared References and Equality–Shared References and Equality, Multiple-target assignment and shared references, Augmented assignment and shared references, Arguments and Shared References–Arguments and Shared References
-
- about, Shared References–Shared References
- arguments and, Arguments and Shared References–Arguments and Shared References
- augmented assignments and, Augmented assignment and shared references
- equality and, Shared References and Equality–Shared References and Equality
- in-place changes and, Shared References and In-Place Changes–Shared References and In-Place Changes
- multiple-target assignments and, Multiple-target assignment and shared references
- Shed Skin system, Python Implementation Alternatives, Shed Skin: A Python-to-C++ translator
- shell tools and commands, Is Python a “Scripting Language”?, Is Python a “Scripting Language”?, Systems Programming, Generating Both Offsets and Items: enumerate–Generating Both Offsets and Items: enumerate
-
- (see also system command lines and files)
- shelve module, Nesting Revisited, The has_key method is dead in 3.X: Long live in!, Polymorphism and classes, Pickles and Shelves, The shelve module, Storing Objects on a Shelve Database, Exploring Shelves Interactively–Exploring Shelves Interactively, Exploring Shelves Interactively, Updating Objects on a Shelve, Stream Processors Revisited, The pickle Object Serialization Module–The pickle Object Serialization Module
-
- about, Polymorphism and classes, Pickles and Shelves, The shelve module
- dictionary interfaces and, The has_key method is dead in 3.X: Long live in!
- exploring shelves interactively, Exploring Shelves Interactively–Exploring Shelves Interactively
- object persistence and, Nesting Revisited, Stream Processors Revisited
- open function, Exploring Shelves Interactively
- pickle module and, The pickle Object Serialization Module–The pickle Object Serialization Module
- storing objects on database, Storing Objects on a Shelve Database
- updating objects, Updating Objects on a Shelve
- shelves, The has_key method is dead in 3.X: Long live in! (see access-by-key databases and filesystems)
- singleton classes, Singleton Classes–Coding alternatives
- slice expressions, Intercepting Slices
- slice objects, Intercepting Slices
- slicing, Sequence Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects, Indexing, Slicing, and Matrixes, Index and slice assignments–Index and slice assignments, Tuples, Nonexhaustive Traversals: range Versus Slices, Indexing and Slicing: __getitem__ and __setitem__–Slicing and Indexing in Python 2.X
-
- lists, Indexing, Slicing, and Matrixes, Index and slice assignments–Index and slice assignments
- nonexhaustive traversals, Nonexhaustive Traversals: range Versus Slices
- operator overloading and, Indexing and Slicing: __getitem__ and __setitem__–Slicing and Indexing in Python 2.X
- strings, Sequence Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects
- tuples, Tuples
- slots, Other Attribute Management Tools, Example: Mapping Attributes to Inheritance Sources, Slots: Attribute Declarations, Slots and namespace dictionaries–Slots and namespace dictionaries, Multiple __slot__ lists in superclasses, Handling slots and other “virtual” attributes generically–Handling slots and other “virtual” attributes generically, Slot usage rules, Example impacts of slots: ListTree and mapattrs, What about slots speed?, Descriptors and slots and more, Using __dict__ and __slots__ (and other virtual names)
-
- about, Example: Mapping Attributes to Inheritance Sources, Slots: Attribute Declarations
- descriptors and, Descriptors and slots and more
- example impacts of, Example impacts of slots: ListTree and mapattrs
- handling generically, Handling slots and other “virtual” attributes generically–Handling slots and other “virtual” attributes generically
- managing attributes, Other Attribute Management Tools
- namespace dictionaries and, Slots and namespace dictionaries–Slots and namespace dictionaries
- private attributes and, Using __dict__ and __slots__ (and other virtual names)
- speed considerations, What about slots speed?
- superclasses and, Multiple __slot__ lists in superclasses
- usage rules, Slot usage rules
- socket module, Python’s Core Data Types
- sorted built-in function, Sorting Keys: for Loops, More on sorting lists, Sorting dictionary keys in 3.X, Conversions, methods, and immutability, Python 2.X and 3.X dictionary comparisons, Other Iteration Contexts
-
- about, Sorting Keys: for Loops
- dictionaries and, Sorting dictionary keys in 3.X, Python 2.X and 3.X dictionary comparisons
- iteration and, Other Iteration Contexts
- lists and, More on sorting lists
- tuples and, Conversions, methods, and immutability
- sorting, Sorting Keys: for Loops–Sorting Keys: for Loops, More on sorting lists–More on sorting lists, More on sorting lists, More Dictionary Methods, Sorting dictionary keys in 3.X, Python 2.X and 3.X mixed-type comparisons and sorts
-
- keys, Sorting Keys: for Loops–Sorting Keys: for Loops, More Dictionary Methods, Sorting dictionary keys in 3.X
- lists, More on sorting lists–More on sorting lists
- version considerations, More on sorting lists, Python 2.X and 3.X mixed-type comparisons and sorts
- source code, Byte code compilation, Byte code compilation
-
- about, Byte code compilation
- timestamps in, Byte code compilation
- spaces versus tabs, Avoid mixing tabs and spaces: New error checking in 3.X
- Sphinx tool, Python Documentation Sources, Beyond docstrings: Sphinx
- SQL database API, On the other hand: performance, conciseness, expressiveness
- square brackets [ ], Python’s Core Data Types, Adding Keys, Attributes, and Offsets, Statement rule special cases
- square roots, Other Built-in Numeric Tools
- stack traces, Default Exception Handler, Example: Default Behavior
- Stackless Python, Systems Programming, Stackless: Python for concurrency
- stacks, Other common list methods, Recursion versus queues and stacks, Recursion versus queues and stacks, Cycles, paths, and stack limits, Alternative Codings, Implementation alternatives: __getattribute__ inserts, call stack inspection–Implementation alternatives: __getattribute__ inserts, call stack inspection
-
- inspecting, Implementation alternatives: __getattribute__ inserts, call stack inspection–Implementation alternatives: __getattribute__ inserts, call stack inspection
- LIFO, Other common list methods, Recursion versus queues and stacks
- limiting depth of, Cycles, paths, and stack limits
- recursion versus, Recursion versus queues and stacks, Alternative Codings
- standard error stream (stderr), Automatic stream redirection, Destructor Usage Notes
- standard input stream (stdin), Neutralizing display differences with code
- standard library, Why Do People Use Python?, Still Other Launch Options
-
- about, Why Do People Use Python?
- launch options, Still Other Launch Options
- standard output stream (stdout), Other File Tools, Print Operations, Neutralizing display differences with code
- state information, User-Defined Classes, Factory Functions: Closures, Why nonlocal? State Retention Options–State with mutables: Obscure ghost of Pythons past?, Cycles, paths, and stack limits, Function Attributes, State suspension, Default Printing and State–Default Printing and State, Using State Information in Descriptors–Using State Information in Descriptors, Option 1: Validating with shared descriptor instance state–Option 2: Validating with per-client-instance state, Decorator State Retention Options–Function attributes, State retention and enclosing scopes
-
- about, User-Defined Classes
- built-in exception classes and, Default Printing and State–Default Printing and State
- class decorators and, State retention and enclosing scopes
- in descriptors, Using State Information in Descriptors–Using State Information in Descriptors
- factory functions and, Factory Functions: Closures
- function attributes and, Function Attributes
- function decorators and, Decorator State Retention Options–Function attributes
- generator functions, State suspension
- nonlocal statement and, Why nonlocal? State Retention Options–State with mutables: Obscure ghost of Pythons past?
- recursive functions and, Cycles, paths, and stack limits
- validating with descriptors and, Option 1: Validating with shared descriptor instance state–Option 2: Validating with per-client-instance state
- statements, Usage Notes: The Interactive Prompt, Usage Notes: The Interactive Prompt, System Command Lines and Files, The Python Conceptual Hierarchy, The Python Conceptual Hierarchy, Introducing Python Statements, Python’s Statements–Python’s Statements, Python’s Statements, Python’s Statements, A Tale of Two ifs–Block rule special case, What Python Adds, Parentheses are optional, End-of-line is end of statement, End-of-line is end of statement, End of indentation is end of block–Why Indentation Syntax?, Statement rule special cases–Block rule special case, Statement rule special cases, Statement rule special cases, A Quick Example: Interactive Loops–Nesting Code Three Levels Deep, Test Your Knowledge: Quiz, Assignment Statements–Test Your Knowledge: Answers, Expression Statements–Expression Statements and In-Place Changes, Python Syntax Revisited–A Few Special Cases, Python Syntax Revisited, Statement Delimiters: Lines and Continuations, Statement Delimiters: Lines and Continuations, A Few Special Cases–A Few Special Cases, Statement Order Matters in Top-Level Code
-
- about, Introducing Python Statements
- assignment, Python’s Statements, Assignment Statements–Test Your Knowledge: Answers
- colon character and, What Python Adds
- common usage mistakes, Usage Notes: The Interactive Prompt
- compound, Usage Notes: The Interactive Prompt (see compound statements)
- continuation lines in, Statement rule special cases, Statement Delimiters: Lines and Continuations
- control-flow, Python Syntax Revisited
- delimiting, Statement Delimiters: Lines and Continuations
- expressions and, The Python Conceptual Hierarchy, Expression Statements–Expression Statements and In-Place Changes
- indenting, End of indentation is end of block–Why Indentation Syntax?
- interactive loops example, A Quick Example: Interactive Loops–Nesting Code Three Levels Deep
- listed, Python’s Statements–Python’s Statements
- modules and, System Command Lines and Files, The Python Conceptual Hierarchy, Statement Order Matters in Top-Level Code
- parentheses and, Parentheses are optional, Statement rule special cases
- Python syntax model, A Tale of Two ifs–Block rule special case
- quiz questions and answers, Test Your Knowledge: Quiz
- semicolon and, End-of-line is end of statement
- special case rules, Statement rule special cases–Block rule special case, A Few Special Cases–A Few Special Cases
- syntax rules, Python Syntax Revisited–A Few Special Cases
- terminating, End-of-line is end of statement
- version considerations, Python’s Statements
- static methods, Other Method Call Possibilities, Static and Class Methods, Static Methods in 2.X and 3.X–Static Methods in 2.X and 3.X, Static Method Alternatives, Using Static and Class Methods–Using Static and Class Methods, Counting Instances with Static Methods
-
- about, Other Method Call Possibilities, Static and Class Methods
- alternatives for, Static Method Alternatives
- counting instances, Counting Instances with Static Methods
- usage considerations, Using Static and Class Methods–Using Static and Class Methods
- version considerations, Static Methods in 2.X and 3.X–Static Methods in 2.X and 3.X
- staticmethod built-in function, Unbound Methods Are Functions in 3.X, Static and Class Methods, Using Static and Class Methods–Using Static and Class Methods
- steps in slicing, Extended slicing: The third limit and slice objects
- StopIteration exception, The Iteration Protocol: File Iterators, The full iteration protocol, Iteration protocol integration
- storing objects and data, Storing Python Objects in Files: Conversions–Storing Python Objects in Files: Conversions, Storing Native Python Objects: pickle, Storing Python Objects in JSON Format–Storing Python Objects in JSON Format, Storing Packed Binary Data: struct, Storing Packed Binary Data: struct, Other File Tools, Step 7 (Final): Storing Objects in a Database–Updating Objects on a Shelve, Storing Objects on a Shelve Database, Choose per-instance or class storage wisely, How Python Stores Strings in Memory
-
- binary data, Storing Packed Binary Data: struct
- class building example, Step 7 (Final): Storing Objects in a Database–Updating Objects on a Shelve
- class gotchas, Choose per-instance or class storage wisely
- in files, Storing Python Objects in Files: Conversions–Storing Python Objects in Files: Conversions
- in JSON format, Storing Python Objects in JSON Format–Storing Python Objects in JSON Format
- pickle module, Storing Native Python Objects: pickle, Other File Tools
- on shelve database, Storing Objects on a Shelve Database
- strings, How Python Stores Strings in Memory
- struct module, Storing Packed Binary Data: struct
- str built-in function, Numbers, Python Expression Operators, Numeric Display Formats, String Conversion Tools, Advanced Formatting Method Syntax, Type Objects
-
- about, String Conversion Tools, Type Objects
- display formats, Numeric Display Formats
- string formatting method calls and, Advanced Formatting Method Syntax
- usage example, Numbers
- version considerations, Python Expression Operators
- __str__ method, A Third Example, Providing Print Displays–Providing Print Displays, A Generic Display Tool, Common Operator Overloading Methods, String Representation: __repr__ and __str__–Display Usage Notes, Listing inherited attributes with dir, Custom Print Displays
-
- about, Common Operator Overloading Methods, String Representation: __repr__ and __str__–Display Usage Notes
- custom print displays, Custom Print Displays
- inheritance and, A Third Example, Listing inherited attributes with dir
- print display example, Providing Print Displays–Providing Print Displays, A Generic Display Tool
- str string type, Unicode Strings, Unicode: The Short Story, Escape Sequences Represent Special Characters, Text and Binary Files: The Short Story, Python’s String Types–Why the different string types?, Python 2.X Unicode literals in Python 3.3, Byte String Literals: Encoded Text, Mixing String Types, The re Pattern-Matching Module
-
- about, Python’s String Types–Why the different string types?
- converting, Mixing String Types
- encoded text, Byte String Literals: Encoded Text
- re module and, The re Pattern-Matching Module
- text files and, Text and Binary Files: The Short Story
- Unicode literals, Unicode Strings, Unicode: The Short Story, Python 2.X Unicode literals in Python 3.3
- version considerations, Escape Sequences Represent Special Characters
- stream redirection, Command-Line Usage Variations
- strides in slicing, Extended slicing: The third limit and slice objects
- string formatting, Type-Specific Methods, Numeric Display Formats, Hex, Octal, Binary: Literals and Conversions, String Basics, String Formatting Expressions–Dictionary-Based Formatting Expressions, Advanced Formatting Expression Syntax–Advanced Formatting Expression Syntax, String Formatting Method Calls–Functions versus expressions: A minor convenience, Advanced Formatting Method Syntax, Method Calls
-
- about, Type-Specific Methods, Numeric Display Formats, Method Calls
- converting integers to strings, Hex, Octal, Binary: Literals and Conversions
- expressions technique, String Formatting Expressions–Dictionary-Based Formatting Expressions
- literals, String Basics
- method calls technique, String Formatting Method Calls–Functions versus expressions: A minor convenience
- nesting, Advanced Formatting Method Syntax
- type codes, Advanced Formatting Expression Syntax–Advanced Formatting Expression Syntax
- string module, The Original string Module’s Functions (Gone in 3.X)–The Original string Module’s Functions (Gone in 3.X), Relative Import Basics–Relative imports versus absolute package paths, Imports outside packages–Imports are still relative to the CWD, again
-
- about, The Original string Module’s Functions (Gone in 3.X)–The Original string Module’s Functions (Gone in 3.X)
- relative imports examples, Relative Import Basics–Relative imports versus absolute package paths, Imports outside packages–Imports are still relative to the CWD, again
- strings (str object), Python’s Core Data Types, Python’s Core Data Types, Strings, Sequence Operations–Sequence Operations, Sequence Operations, Sequence Operations, Sequence Operations, Sequence Operations, Immutability, Immutability, Type-Specific Methods, Type-Specific Methods, Type-Specific Methods, Type-Specific Methods, Getting Help, Getting Help, Other Ways to Code Strings, Unicode Strings–Unicode Strings, Pattern Matching, Numeric Display Formats, Hex, Octal, Binary: Literals and Conversions, String Fundamentals, Unicode: The Short Story, Unicode: The Short Story, String Basics–Triple Quotes Code Multiline Block Strings, String Basics–Basic Operations, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, String Basics, Escape Sequences Represent Special Characters–Raw Strings Suppress Escapes, Escape Sequences Represent Special Characters, Triple Quotes Code Multiline Block Strings–Triple Quotes Code Multiline Block Strings, Triple Quotes Code Multiline Block Strings, Basic Operations, Basic Operations, Basic Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects, Indexing and Slicing–Extended slicing: The third limit and slice objects, Extended slicing: The third limit and slice objects, String Conversion Tools–Character code conversions, Changing Strings I, Changing Strings I, Changing Strings I, Changing Strings I, String Methods–The Original string Module’s Functions (Gone in 3.X), String Method Examples: Changing Strings II–String Method Examples: Changing Strings II, String Method Examples: Changing Strings II, String Method Examples: Changing Strings II, String Method Examples: Changing Strings II, String Method Examples: Parsing Text, String Method Examples: Parsing Text, Other Common String Methods in Action, The 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), Formatting Method Basics, Advanced Formatting Method Syntax, Advanced Formatting Method Examples, Comparison to the % Formatting Expression–Functions versus expressions: A minor convenience, Comparison to the % Formatting Expression, Test Your Knowledge: Quiz, More on sorting lists, More on sorting lists, Storing Python Objects in Files: Conversions, Storing Python Objects in Files: Conversions, Comparisons, Equality, and Truth, Handling Errors by Testing Inputs, Python Syntax Revisited, Statement Delimiters: Lines and Continuations, Nonexhaustive Traversals: range Versus Slices, Using List Comprehensions on Files, Other Iteration Contexts, Python Documentation Sources, Docstrings: __doc__–Built-in docstrings, Generator Expressions: Iterables Meet Comprehensions, Timing Module: Homegrown, Currency Symbols: Unicode in Action–Currency Symbols: Unicode in Action, Importing Modules by Name String–Direct Calls: Two Options, String Representation: __repr__ and __str__–Display Usage Notes, Listing attributes per object in class trees, Listing attributes per object in class trees, Usage variation: Showing underscore name values, Example: Catching Built-in Exceptions, String Exceptions Are Right Out!, Unicode and Byte Strings–String Changes in 3.X, String Basics–Text and Binary Files, Character Encoding Schemes, Coding Basic Strings–String Type Conversions, Python 3.X String Literals–Python 2.X String Literals, String Type Conversions, String Type Conversions, Coding Unicode Strings–Source File Character Set Encoding Declarations, Type and Content Mismatches in 3.X, Unicode Files in 2.X, Other String Tool Changes in 3.X–XML Parsing Tools, Test Your Knowledge: Quiz–Test Your Knowledge: Answers
-
- about, Python’s Core Data Types, Strings, String Fundamentals, String Basics–Text and Binary Files
- __add__ method, Getting Help
- alternate ways to code, Other Ways to Code Strings
- backslash characters, Escape Sequences Represent Special Characters–Raw Strings Suppress Escapes
- casefold method, More on sorting lists
- changing, Immutability, Changing Strings I, String Method Examples: Changing Strings II–String Method Examples: Changing Strings II
- coding, Coding Basic Strings–String Type Conversions
- common operations, String Basics–Basic Operations
- comparison operations, Comparisons, Equality, and Truth
- concatenating, Sequence Operations, Getting Help, Basic Operations, Example: Catching Built-in Exceptions
- converting, Hex, Octal, Binary: Literals and Conversions, String Basics, String Conversion Tools–Character code conversions
- debugging, Usage variation: Showing underscore name values
- decode method, String Basics, String Type Conversions
- documentation, Triple Quotes Code Multiline Block Strings, Python Syntax Revisited, Python Documentation Sources, Docstrings: __doc__–Built-in docstrings
- empty strings, String Basics
- encode method, String Basics, Character Encoding Schemes, String Type Conversions
- endswith method, String Basics, Other Common String Methods in Action
- exceptions based on, String Exceptions Are Right Out!
- find method, Type-Specific Methods, String Basics, Basic Operations, String Method Examples: Changing Strings II
- format method, Formatting Method Basics, Advanced Formatting Method Syntax, Advanced Formatting Method Examples, Comparison to the % Formatting Expression–Functions versus expressions: A minor convenience, Listing attributes per object in class trees
- formatting, Numeric Display Formats (see string formatting)
- garbage collection and, Changing Strings I
- immutable, Immutability, String Basics, Changing Strings I
- importing modules by name string, Importing Modules by Name String–Direct Calls: Two Options
- indexing, Sequence Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects
- isdigit method, String Basics, Handling Errors by Testing Inputs
- join method, String Basics, String Method Examples: Changing Strings II, Other Iteration Contexts, Generator Expressions: Iterables Meet Comprehensions
- literals, Python’s Core Data Types, String Basics–Triple Quotes Code Multiline Block Strings, Statement Delimiters: Lines and Continuations, Python 3.X String Literals–Python 2.X String Literals
- lower method, String Basics, More on sorting lists
- multiline block strings, Triple Quotes Code Multiline Block Strings–Triple Quotes Code Multiline Block Strings
- nonexhaustive traversals, Nonexhaustive Traversals: range Versus Slices
- operator overloading and, String Representation: __repr__ and __str__–Display Usage Notes
- parsing text, String Method Examples: Parsing Text
- pattern matching, Pattern Matching, The Original string Module’s Functions (Gone in 3.X)
- quiz questions and answers, Test Your Knowledge: Quiz, Test Your Knowledge: Quiz–Test Your Knowledge: Answers
- repeating, Sequence Operations, Basic Operations
- replace method, Type-Specific Methods, String Basics, Changing Strings I, String Method Examples: Changing Strings II
- rstrip method, String Basics, Extended slicing: The third limit and slice objects, Storing Python Objects in Files: Conversions, Using List Comprehensions on Files
- sequence operations, Sequence Operations–Sequence Operations
- slicing, Sequence Operations, Indexing and Slicing–Extended slicing: The third limit and slice objects
- split method, String Basics, String Method Examples: Parsing Text, Storing Python Objects in Files: Conversions
- tool changes, Other String Tool Changes in 3.X–XML Parsing Tools
- type and content mismatches, Type and Content Mismatches in 3.X
- type-specific methods, Type-Specific Methods, String Basics, String Methods–The Original string Module’s Functions (Gone in 3.X)
- Unicode, Unicode Strings–Unicode Strings, Unicode: The Short Story, Currency Symbols: Unicode in Action–Currency Symbols: Unicode in Action, Coding Unicode Strings–Source File Character Set Encoding Declarations
- upper method, Type-Specific Methods, Timing Module: Homegrown
- version considerations, Unicode: The Short Story, Escape Sequences Represent Special Characters, The Original string Module’s Functions (Gone in 3.X)–The Original string Module’s Functions (Gone in 3.X), Comparison to the % Formatting Expression, Listing attributes per object in class trees, Unicode and Byte Strings–String Changes in 3.X, Unicode Files in 2.X
- strong typing, Python’s Core Data Types
- struct module, Binary Bytes Files, Storing Packed Binary Data: struct, Why the different string types?, The struct Binary Data Module–The struct Binary Data Module
- __sub__ method, Constructors and Expressions: __init__ and __sub__
- subclasses, Attribute Inheritance Search, Classes Are Customized by Inheritance, A Third Example, Step 4: Customizing Behavior by Subclassing–OOP: The Big Idea, Coding Subclasses, Specializing Inherited Methods, Class Interface Techniques–Class Interface Techniques, Extending Types by Subclassing–Extending Types by Subclassing, Metaclasses Are Subclasses of Type
-
- about, Attribute Inheritance Search
- class interface techniques, Class Interface Techniques–Class Interface Techniques
- coding, Coding Subclasses
- customizing behavior, Classes Are Customized by Inheritance, Step 4: Customizing Behavior by Subclassing–OOP: The Big Idea
- extending built-in types, Extending Types by Subclassing–Extending Types by Subclassing
- inheritance and, A Third Example, Specializing Inherited Methods
- type object and, Metaclasses Are Subclasses of Type
- subprocess module, Other File Tools, Generating Both Offsets and Items: enumerate
- substitution operations in string formatting, Type-Specific Methods
- sum built-in function, Comprehensions, Other Built-in Numeric Tools, Summation with Recursion
- super built-in function, Augmenting Methods: The Good Way, Other Method Call Possibilities, The super Built-in Function: For Better or Worse?, The Great super Debate–The Great super Debate, Basic super Usage and Its Tradeoffs–The super Upsides: Tree Changes and Dispatch, Odd semantics: A magic proxy in Python 3.X–Pitfall: Adding multiple inheritance naively, Limitation: Operator overloading, Use differs in Python 2.X: Verbose calls, Runtime Class Changes and super, Cooperative Multiple Inheritance Method Dispatch–Customization: Same-argument constraints, The super Summary
-
- about, Augmenting Methods: The Good Way, Other Method Call Possibilities, The super Built-in Function: For Better or Worse?
- basic usage and tradeoffs, Basic super Usage and Its Tradeoffs–The super Upsides: Tree Changes and Dispatch
- debates about, The Great super Debate–The Great super Debate
- multiple inheritance and, Odd semantics: A magic proxy in Python 3.X–Pitfall: Adding multiple inheritance naively, Cooperative Multiple Inheritance Method Dispatch–Customization: Same-argument constraints
- operator overloading and, Limitation: Operator overloading
- runtime class changes, Runtime Class Changes and super
- summary of, The super Summary
- version considerations, Use differs in Python 2.X: Verbose calls
- superclasses, Attribute Inheritance Search, Classes Are Customized by Inheritance, Inherit, Customize, and Extend, Calling Superclass Constructors, Specializing Inherited Methods, Class Interface Techniques–Class Interface Techniques, Abstract Superclasses–Abstract superclasses in Python 3.X and 2.6+: Preview, Stream Processors Revisited, Multiple Inheritance: “Mix-in” Classes, Multiple __slot__ lists in superclasses, Traditional Superclass Call Form: Portable, General, You usually want to call superclass constructors, Mix-in superclasses, Metaclass Versus Superclass
-
- about, Attribute Inheritance Search
- abstract, Abstract Superclasses–Abstract superclasses in Python 3.X and 2.6+: Preview, Stream Processors Revisited
- class gotchas, You usually want to call superclass constructors
- class interface techniques, Class Interface Techniques–Class Interface Techniques
- constructor methods, Calling Superclass Constructors
- customizing, Inherit, Customize, and Extend
- inheritance and, Specializing Inherited Methods
- metaclasses versus, Metaclass Versus Superclass
- multiple inheritance and, Multiple Inheritance: “Mix-in” Classes
- operator overloading methods and, Mix-in superclasses
- parentheses and, Classes Are Customized by Inheritance
- slots and, Multiple __slot__ lists in superclasses
- traditional forms, Traditional Superclass Call Form: Portable, General
- sys module, A First Script, Usage Notes: import and reload, Extended slicing: The third limit and slice objects, Adding Keys, Attributes, and Offsets, Other File Tools, Print Operations, The Python “hello world” program–Automatic stream redirection, Automatic stream redirection, Neutralizing display differences with code, Neutralizing display differences with code, Other Ways to Access Globals, Cycles, paths, and stack limits, Cycles, paths, and stack limits, Timing Module: Homegrown, Benchmark Script Results, 3. Run It, The sys.path List, Relative Import Basics, Module Lookup Rules Summary, Example: Dual Mode Code, Changing the Module Search Path, Example: Modules Are Objects, Destructor Usage Notes, Providing Exception Methods, Exceptions Aren’t Always Errors, Debugging with Outer try Statements, Debugging with Outer try Statements, Running In-Process Tests–Displaying Errors and Tracebacks, Catching Too Much: Avoid Empty except and Exception, Unicode Filenames and Streams
-
- argv attribute, Extended slicing: The third limit and slice objects, Benchmark Script Results, Example: Dual Mode Code
- excepthook function, Debugging with Outer try Statements
- exc_info function, Providing Exception Methods, Debugging with Outer try Statements, Running In-Process Tests–Displaying Errors and Tracebacks
- exit function, Exceptions Aren’t Always Errors, Catching Too Much: Avoid Empty except and Exception
- file name settings, Unicode Filenames and Streams
- getrecursionlimit function, Cycles, paths, and stack limits
- modules dictionary, Other Ways to Access Globals, 3. Run It, Example: Modules Are Objects
- path list, Usage Notes: import and reload, The sys.path List, Relative Import Basics, Module Lookup Rules Summary, Changing the Module Search Path
- platform attribute, A First Script, Adding Keys, Attributes, and Offsets, Timing Module: Homegrown
- setrecursionlimit function, Cycles, paths, and stack limits
- stderr attribute, Automatic stream redirection, Destructor Usage Notes
- stdin attribute, Neutralizing display differences with code
- stdout attribute, Other File Tools, Print Operations, The Python “hello world” program–Automatic stream redirection, Neutralizing display differences with code
- system command lines and files, Starting an Interactive Session, Starting an Interactive Session, What Not to Type: Prompts and Comments, System Command Lines and Files, A First Script, Running Files with Command Lines, Command-Line Usage Variations, Usage Notes: Command Lines and Files, Other File Tools, Generating Both Offsets and Items: enumerate–Generating Both Offsets and Items: enumerate, Other Built-in Type Iterables, Command-line usage, Benchmark Script Results, Testing reload variants, Python Command-Line Arguments–Python 3.3 Windows Launcher Command Lines
-
- about, System Command Lines and Files, Python Command-Line Arguments–Python 3.3 Windows Launcher Command Lines
- common usage mistakes, Usage Notes: Command Lines and Files
- running files with command lines, Running Files with Command Lines
- running in Python, Other File Tools, Generating Both Offsets and Items: enumerate–Generating Both Offsets and Items: enumerate, Other Built-in Type Iterables, Benchmark Script Results, Testing reload variants
- starting interactive sessions, Starting an Interactive Session
- system shell prompt, Starting an Interactive Session, What Not to Type: Prompts and Comments
- timeit module and, Command-line usage
- usage variations, Command-Line Usage Variations
- writing scripts, A First Script
- system shell prompt, Starting an Interactive Session, What Not to Type: Prompts and Comments, Running Files with Command Lines
-
- about, Starting an Interactive Session, What Not to Type: Prompts and Comments
- running files, Running Files with Command Lines
- SystemExit exception, Exceptions Aren’t Always Errors, Catching Too Much: Avoid Empty except and Exception
- systeminfo command, Generating Both Offsets and Items: enumerate
- systems programming, Systems Programming