Index
A
- absolute imports
- about / Absolute imports
- abstract factory pattern
- about / Abstract factory pattern
- examples / Abstract factory pattern
- UML class diagram / Abstract factory pattern
- implementing / Abstract factory pattern
- abstraction
- access control
- about / Who can access my data?
- adapter pattern
- about / Adapter pattern
- structure / Adapter pattern
- UML diagram / Adapter pattern
- benefits / Adapter pattern
- add_child method / Composite pattern
- add_point method / Treat objects as objects
- Agent class / Case study
- aggregation
- about / Composition and inheritance
- all() method / Adding and querying objects
- API SQLite / Database access
- append() method / Lists
- append method / Raising an exception
- arguments, for controlling widget
- assertDictEqual method / Additional assertion methods in Python 3.1
- assertEqual method / Assertion methods
- assertFalse method / Assertion methods
- assert function / Making it do something
- assertGreaterEqual method / Additional assertion methods in Python 3.1
- assertGreater method / Additional assertion methods in Python 3.1
- assertIn method / Additional assertion methods in Python 3.1
- assertion methods, Python 3.1
- about / Additional assertion methods in Python 3.1
- assertGreaterEqual / Additional assertion methods in Python 3.1
- assertLess / Additional assertion methods in Python 3.1
- assertLessEqual / Additional assertion methods in Python 3.1
- assertGreater / Additional assertion methods in Python 3.1
- assertIn / Additional assertion methods in Python 3.1
- assertNotIn / Additional assertion methods in Python 3.1
- assertIsNone / Additional assertion methods in Python 3.1
- assertIsNotNone / Additional assertion methods in Python 3.1
- assertSameElements / Additional assertion methods in Python 3.1
- assertSequenceEqual / Additional assertion methods in Python 3.1
- assertTupleEqual / Additional assertion methods in Python 3.1
- assertDictEqual / Additional assertion methods in Python 3.1
- assertSetEqual / Additional assertion methods in Python 3.1
- assertListEqual / Additional assertion methods in Python 3.1
- assertMultilineEqual / Additional assertion methods in Python 3.1
- assertRegexpMatches / Additional assertion methods in Python 3.1
- assertion methods, unit testing
- about / Assertion methods
- assertEqual / Assertion methods
- assertNotEqual / Assertion methods
- assertTrue / Assertion methods
- assertFalse / Assertion methods
- assertRaises / Assertion methods
- assertIsNone method / Additional assertion methods in Python 3.1
- assertIsNotNone method / Additional assertion methods in Python 3.1
- assertLessEqual method / Additional assertion methods in Python 3.1
- assertLess method / Additional assertion methods in Python 3.1
- assertListEqual method / Additional assertion methods in Python 3.1
- assertMultilineEqual method / Additional assertion methods in Python 3.1
- assertNotEqual method / Assertion methods
- assertNotIn method / Additional assertion methods in Python 3.1
- assertRaises method / Assertion methods
- assertRegexpMatches method / Additional assertion methods in Python 3.1
- assertSameElements method / Additional assertion methods in Python 3.1
- assertSequenceEqual method / Additional assertion methods in Python 3.1
- assertSetEqual method / Additional assertion methods in Python 3.1
- assertTrue method / Assertion methods
- assertTupleEqual method / Additional assertion methods in Python 3.1
- association / Objects and classes
- attributes
- about / Data describes objects
- AudioFile object / Polymorphism
- authentication
- about / Case study
- authentication and authorization system, case study
- designing / Case study
- about / Case study
- authorization
- about / Case study
B
- Base class / Introducing SQLAlchemy
- BaseException / Raising exceptions
- basic inheritance
- about / Basic inheritance
- example / Basic inheritance
- built-ins, extending / Extending built-ins
- overriding / Overriding and super
- super() / Overriding and super
- behaviors
- about / Object-oriented?
- adding to class data, properties used / Using properties to add behavior to class data
- boolean convenience methods
- isalpha / String manipulation
- isnumeric / String manipulation
- isdecimal / String manipulation
- isdigit / String manipulation
- isalnum / String manipulation
- isspace / String manipulation
- islower / String manipulation
- isupper / String manipulation
- istitle / String manipulation
- isidentifier / String manipulation
- isprintable / String manipulation
- bottom-up design / Exercises
- built-in functions, Python
- about / Python built-in functions
- len() function / Len
- reversed() function / Reversed
- enumerate function / Enumerate
- zip function / Zip
- sorted() function / Other functions
- true function / Other functions
- any function / Other functions
- all function / Other functions
- compile function / Other functions
- exec function / Other functions
- eval function / Other functions
- delattr function / Other functions
- setattr function / Other functions
- getattr function / Other functions
- hasattr function / Other functions
- bytearray type
- about / Mutable byte strings
- BytesIO / Faking files
- bytes mode / File IO
C
- calculate_distance method / Making it do something
- callable attributes
- about / Using functions as attributes
- callable objects
- about / Callable objects
- callback functions
- about / Functions are objects too
- call_after method / Functions are objects too
- call_me method / The diamond problem
- canonical example, strategy pattern
- about / Strategy example
- capitalize method / String manipulation
- case study
- notebook application / Case study
- simple real estate application / Case study
- authentication and authorization system / Case study
- Document class, modeling / Case study
- simple link collector / Case study
- mailing list manager / Case study
- cryptography application, writing / Case Study
- CHARACTERS list / Lists
- CherryPy
- about / CherryPy
- features / CherryPy, A full web stack?
- example / CherryPy
- CherryPy blog web application
- about / The CherryPy blog web application
- designing / The CherryPy blog web application
- ChildNode state / State example
- cipher
- working / Case Study
- class
- about / Objects and classes
- class diagram
- about / Objects and classes
- association / Objects and classes
- multiplicity / Objects and classes
- cleanup function / A completely different way to set up variables
- close method / File IO
- code coverage / figleafaboutHow much testing is enough?
- collect_links method / Case study
- command-line arguments, py.test
- py.test --help / py.test extras
- py.test output / py.test extras
- to py.test forces / py.test extras
- --pdb argument / py.test extras
- --looponfail argument / py.test extras
- -f argument / py.test extras
- --exitfirst argument / py.test extras
- -k argument / py.test extras
- Command object / Command pattern
- command pattern
- about / Command pattern
- UML diagram, / Command pattern
- example / Command pattern
- implementing / Command pattern
- Component class / Composite pattern
- composite pattern
- about / Composite pattern
- UML diagram / Composite pattern
- implementing / Composite pattern
- composition
- about / Composition and inheritance
- example / Composition and inheritance
- composition relationship
- about / Composition and inheritance
- comprehensions
- about / Comprehensions
- list comprehensions / List comprehensions
- dictionary comprehensions / Set and dictionary comprehensions
- set comprehensions / Set and dictionary comprehensions
- generator expressions / Generator expressions
- config attribute / A completely different way to set up variables
- connect function / Database access
- connection object / Database access
- constructor / Initializing the object
- Contact class / Basic inheritance
- ContactList class / Extending built-ins
- count() method / Lists
- count method / String manipulation
- coverage.py
- coverage report command
- coverage testing
- about / figleafaboutHow much testing is enough?
- figleaf / figleafaboutHow much testing is enough?
- coverage.py / figleafaboutHow much testing is enough?
- create_engine function / Introducing SQLAlchemy
- cryptography application, case study
- writing / Case Study
- cipher, working / Case Study
- implementing / Implementing it
- CurrencyFormatter class / Abstract factory pattern
- current_node / State example
- Cursor class / Case study
D
- data
- about / Object-oriented?
- database access
- about / Database access
- database module
- about / Absolute imports
- database object / Relative imports
- DateFormatter class / Abstract factory pattern
- datetime objects / Adapter pattern
- DBAPI2 / Database access
- DebuggingServer class / Case study
- declarative_base / Introducing SQLAlchemy
- decorator pattern
- about / Decorator pattern
- uses / Decorator pattern
- in UML / Decorator pattern
- network programming example / Decorator example
- in Python / Decorators in Python
- decorator pattern, in Python
- about / Decorators in Python
- logging example / Decorators in Python
- decorators
- default arguments
- about / Default arguments
- defaultdict
- using / Using defaultdict
- defaultdict constructor / Using defaultdict
- default method / Serializing web objects
- delay parameter / Functions are objects too
- delegation method / Managing objects
- design patterns
- about / Design patterns
- decorator pattern / Decorator pattern
- observer pattern / Observer pattern
- strategy pattern / Strategy pattern
- state pattern / State pattern
- singleton pattern / Singleton pattern
- template pattern / Template pattern
- adapter pattern / Adapter pattern
- facade pattern / Facade pattern
- flyweight pattern / Flyweight pattern
- command pattern / Command pattern
- abstract factory pattern / Abstract factory pattern
- composite pattern / Composite pattern
- diamond problem, multiple inheritance
- about / The diamond problem
- example / The diamond problem
- dict() constructor / Dictionaries
- dict.update method / Case study
- dict class / Extending built-ins
- dictionaries
- about / Dictionaries
- stock application example / Dictionaries
- uses / When should we use dictionaries?
- defaultdict, using / Using defaultdict
- dictionary comprehensions
- DictSorted object / Extending built-ins
- difference method / Sets
- discover module / Organizing and running tests
- distance method / Treat objects as objects
- docstrings
- about / Explaining yourself
- Document class, case study
- modeling / Case study
- DOM (Document Object Model) library
- about / XML
- done() method / Design patterns
- dot notation / Adding attributes
- duck typing
- about / Inheritance provides abstraction
- dumps function / Storing objects
E
- Element object / ElementTree
- ElementTree
- about / ElementTree
- example / ElementTree
- XML documents, constructing / Constructing XML documents
- encapsulation
- endswith method / String manipulation
- enumerate function
- about / Enumerate
- exceptional circumstances
- about / Exceptions aren't exceptional
- exception hierarchy
- about / Exception hierarchy
- SystemExit / Exception hierarchy
- KeyboardInterrupt exception / Exception hierarchy
- custom exceptions, defining / Defining our own exceptions
- exceptions
- raising / Raising exceptions, Raising an exception, What happens when an exception occurs?
- handling / Handling exceptions
- using, for exceptional circumstances / Exceptions aren't exceptional
- case study / Case study
- execute() method / Command pattern
- execute method / Database access
F
- facade pattern
- about / Facade pattern
- UML diagram / Facade pattern
- structure / Facade pattern
- figleaf
- file IO
- about / File IO
- placing, in context / Placing it in context
- files, faking / Faking files
- filename property / In practice
- filter() method / Adding and querying objects
- filter_by method / Adding and querying objects
- findall method / lxml
- find method / String manipulation, ElementTree
- findtext method / ElementTree
- find_replace method / Managing objects
- first() method / Adding and querying objects
- FirstTag state / State example
- Flyweight class / Flyweight pattern
- flyweight pattern
- about / Flyweight pattern
- implementing / Flyweight pattern
- UML diagram / Flyweight pattern
- foo function
- foo method
- format() method / String formatting
- format method / Functions are objects too
- FormatterFactory class / Abstract factory pattern
- format_string function / Relative imports
- format_time function / Functions are objects too
- Friend class / The diamond problem
- fruit farming example
- about / Data describes objects
- full_name property / Serializing web objects
- funcargs
G
- generator expressions
- about / Generator expressions
- generator syntax
- about / Generators
- get(primary_key) method / Adding and querying objects
- get method / Dictionaries
- get_path function / Composite pattern
- get_valid_input method / Case study
- group_by() method / Adding and querying objects
- GUI toolkit
- selecting / Choosing a GUI toolkit
- PyGTK / Choosing a GUI toolkit
- wxPython / Choosing a GUI toolkit
H
- hashable object
- about / Sets
- having() method / Adding and querying objects
- help function / Extending built-ins
- House class / Case study
I
- imaplib standard library / Facade pattern
- information hiding
- inheritance
- about / Inheritance
- example / Inheritance
- abstraction / Inheritance provides abstraction
- multiple inheritance / Multiple inheritance, Multiple inheritance
- basic inheritance / Basic inheritance
- inheritance diagram
- about / The diamond problem
- initialize_database function / Relative imports
- insert() method / Lists
- intersection method / Sets
- Invoker objects / Command pattern
- isalnum method / String manipulation
- isalpha method / String manipulation
- isdecimal method / String manipulation
- isdigit method / String manipulation
- isidentifier method / String manipulation
- islower method / String manipulation
- isnumeric method / String manipulation
- isprintable method / String manipulation
- isspace method / String manipulation
- issubset method / Sets
- issuperset method / Sets
- istitle method / String manipulation
- isupper method / String manipulation
- iterative development model
- about / Object-oriented?
- iterator pattern
- about / Design patterns
J
- JavaScript Object Notation (JSON)
- about / Serializing web objects
- Jinja Templating
- about / Jinja Templating
- join function / Case study
- JSONEncoder class / Serializing web objects
- JSON serializer
- about / Serializing web objects
K
- KeyboardInterrupt exception
- about / Exception hierarchy
L
- lambda function / Other functions
- len() function
- about / Len
- links method / CherryPy
- list.sort method / Strategy example
- list comprehensions
- about / List comprehensions
- lists
- about / Lists
- sorting / Sorting lists
- loads function / Storing objects
- lower method / String manipulation
- lxm
- about / lxml
- lxml
- features / lxml
M
- mailing list manager, case study
- building / Case study
- about / Case study
- make_background method / Strategy example
- menu_item class / Command pattern
- message variable / CherryPy
- method overloading
- Method Resolution Order / The diamond problem
- methods
- about / Behaviors are actions
- mixin
- about / Multiple inheritance
- modules
- about / Modules and packages
- organizing / Organizing the modules
- importing / Organizing the modules
- absolute imports / Absolute imports
- relative imports / Relative imports
- monkey-patch
- about / Multiple inheritance
- mousePressEvent method / PyQt
- move method / Composite pattern
- multiple inheritance
- about / Multiple inheritance, Multiple inheritance
- mixin / Multiple inheritance
- options / Multiple inheritance
- working / Multiple inheritance
- example / Multiple inheritance
- diamond problem / The diamond problem
- arguments lists, formatting / Different sets of arguments
- multiplicity / Objects and classes
- mutable byte strings
- about / Mutable byte strings
N
- name attribute / Using properties to add behavior to class data
- namedtuple constructor / Named tuples
- named tuples
- creating / Named tuples
- about / Named tuples
- network programming example, decorator pattern
- about / Decorator example
- new card catalog program, case study
- about / Case study
- UML diagram / Case study
- UML sequence diagram / Case study
- next() method / Design patterns
- Node objects
- about / State example
- normalize_url method / Case study
- notebook application, case study
- about / Case study
- NotImplementedError / Template example
- no_return function / What happens when an exception occurs?
O
- object
- about / Object-oriented?, Objects and classes
- kinds / Objects and classes
- classes relationship, describing / Objects and classes
- class diagram / Objects and classes
- attributes / Data describes objects
- data / Data describes objects
- behaviors / Behaviors are actions
- identifying / Treat objects as objects
- managing / Managing objects
- storing / Storing objects
- object-oriented
- about / Object-oriented?
- object-oriented Analysis (OOA)
- about / Object-oriented?
- object-oriented Design (OOD)
- about / Object-oriented?
- Object-Relational Managers(ORMs)
- about / Database access
- SQLAlchemy / Introducing SQLAlchemy
- object management
- about / Managing objects
- example / Managing objects
- readability / Managing objects
- extensibility / Managing objects
- partitioning / Managing objects
- delegation method / Managing objects
- files, unzipping / Managing objects
- files, zipping / Managing objects
- duplicate code, removing / Removing duplicate code
- existing code, reusing / In practice
- composition-based solution / Or we can use composition
- object relations
- association / Objects and classes
- composition / Composition and inheritance
- inheritance / Inheritance
- objects, storing
- about / Storing objects
- pickles, customizing / Customizing pickles
- web objects, serializing / Serializing web objects
- observer pattern
- about / Observer pattern
- in UML / Observer pattern
- example / Observer example
- one() method / Adding and querying objects
- open() function / File IO
- OpenTag state / State example
- OrderedDict object / Extending built-ins
- order method / Basic inheritance
- order_by() method / Adding and querying objects
P
- p.reset() method / Making it do something
- package
- about / Organizing the modules
- pack method / TkInter
- parameters
- about / Behaviors are actions
- parent variable / Composite pattern
- Parser class / State example
- partition method / String manipulation
- pattern parameter / ElementTree
- paypal module
- about / Relative imports
- perimeter function / Treat objects as objects
- phone attribute / Overriding and super
- pickle module / Storing objects
- plain_text attribute / Who can access my data?
- play() method / Polymorphism
- Point class
- creating / Adding attributes
- reset method / Making it do something
- polymorphism
- about / Inheritance provides abstraction, Polymorphism
- inheritance, using / Polymorphism
- print method / Using functions as attributes
- process method / State example
- processor object / Or we can use composition
- process_comment method / The CherryPy blog web application
- process_files method / In practice
- process_files method / In practice
- process_format method / Template example
- process_zip function / Or we can use composition
- Product class
- about / Absolute imports
- products module
- about / Absolute imports
- prompt_init static method / Case study
- properties
- creating, decorators used / Decorators: another way to create properties
- using / When should we use properties?
- property constructor
- about / How it works
- property keyword / Using properties to add behavior to class data
- property object
- about / Using properties to add behavior to class data
- working / How it works
- public interface
- Purchase class / Case study
- py.test
- about / Testing with py.test
- running / Testing with py.test
- command-line arguments / py.test extras
- py.test.skip function / Test skipping with py.test
- pygame library / In practice
- PyGTK
- about / Choosing a GUI toolkit
- PyQt
- Python
- duck typing / Inheritance provides abstraction
- case study / Case study
- docstrings / Explaining yourself
- access control / Who can access my data?
- objects, identifying / Treat objects as objects
- built-in data structures / Empty objects
- built-in functions / Python built-in functions
- default arguments / Default arguments
- variable argument lists / Variable argument lists
- unpacking arguments / Unpacking arguments
- strings / Strings
- pickle module / Storing objects
- test, need for / Why test?
- test driven development / Test-driven development
- unit testing / Unit testing
- unittest module / Testing with py.test
- coverage testing / figleafaboutHow much testing is enough?
- database access / Database access
- Python classes
- creating / Creating Python classes
- attributes, adding / Adding attributes
- implementing / Making it do something
- object, initializing / Initializing the object
- Python data structures
- objects / Empty objects
- tuples / Tuples and named tuples
- tuples, creating / Tuples and named tuples
- named tuples / Named tuples
- dictionaries / Dictionaries
- lists / Lists
- sets / Sets
- built-ins, extending / Extending built-ins
- PYTHONPATH
- about / Absolute imports
Q
- Query object / Adding and querying objects
- quickstart function / CherryPy
R
- readline method / File IO
- read method / File IO
- relative imports
- about / Relative imports
- Rental class / Case study
- Repeater class / Functions are objects too
- replace method / String manipulation
- request.addfinalizer method / A completely different way to set up variables
- request.cached_setup method / A completely different way to set up variables
- request object / A completely different way to set up variables
- reset method / Making it do something
- reverse() method / Lists
- reversed() function
- about / Reversed
- root node / State example
- run method / Functions are objects too
S
- SAX (Simple API for XML) library
- about / XML
- self parameter / Making it do something
- send_email method / Facade pattern
- send_mail function / Relative imports, Container lookups
- session.query() method / Adding and querying objects
- sessionmaker function / Adding and querying objects
- set() constructor
- about / Sets
- set() method / TkInter
- set comprehensions
- setdefault method / Dictionaries
- sets
- about / Sets
- setter attribute / Decorators: another way to create properties
- setText method / PyQt
- setup function / A completely different way to set up variables
- setUp method / Reducing boilerplate and cleaning up
- set_name() method / Using properties to add behavior to class data
- Silly class / Decorators: another way to create properties
- simple link collector, case study
- writing / Case study
- simple real estate application, case study
- designing / Case study
- about / Case study
- singleton pattern
- about / Singleton pattern
- implementing / Singleton implementation
- mimicking, module variables used / Module variables can mimic singletons
- skip method / Ignoring broken tests
- smtplib module / Multiple inheritance
- sort() method / Lists
- sorted() function
- about / Other functions
- sorted function / Strategy example
- split method / Adapter pattern
- SQLAlchemy
- about / Introducing SQLAlchemy
- features / Introducing SQLAlchemy
- objects, querying / Adding and querying objects
- objects, adding / Adding and querying objects
- SQL Expression Language / SQL Expression Language
- sqlalchemy.create_engine function / Introducing SQLAlchemy
- SQLAlchemy Expression Language
- about / SQL Expression Language
- SQL Expression Language
- about / SQL Expression Language
- SQLite / Database access
- SQLite 3 / Database access
- startswith method / String manipulation
- state pattern
- about / State pattern
- in UML / State pattern
- example / State example
- differences, with strategy pattern / State versus strategy
- str() function / Case study
- str.format method / String formatting
- str.lower function / Sorting lists
- strategy pattern
- about / Strategy pattern
- in UML / Strategy pattern
- canonical example / Strategy example
- in Python / Strategy in Python
- strategy pattern, in Python
- about / Strategy in Python
- str class / String manipulation
- string.ascii_letters attribute / Lists
- string formatting
- about / String formatting
- brace characters, escaping / Escaping braces
- keyword arguments / Keyword arguments
- container lookups / Container lookups
- object lookups / Object lookups
- variables, making look right / Making it look right
- StringIO / Faking files
- string manipulation
- about / String manipulation
- examples / String manipulation
- strings
- about / Strings
- string manipulation / String manipulation
- string formatting / String formatting
- Unicode characters / Strings are Unicode
- mutable byte strings / Mutable byte strings
- StringVar object / TkInter
- strip() / State example
- subclass
- about / Basic inheritance
- Subclass object / The diamond problem
- SubElement function / Constructing XML documents
- super() / Overriding and super
- superclass
- about / Basic inheritance
- supplier class
- about / Basic inheritance
- symmetric_difference method / Sets
- SyntaxError exception / Raising exceptions
- sys.exit function / Exception hierarchy
- SystemExit exception
- about / Exception hierarchy
T
- tearDown method / Reducing boilerplate and cleaning up
- template pattern
- about / Template pattern
- in UML / Template pattern
- example / Template example
- test
- need for / Why test?
- TestCase / Reducing boilerplate and cleaning up
- test driven development
- about / Test-driven development
- testing, with py.test
- about / Testing with py.test
- unittest example / Testing with py.test
- setup_method / One way to do setup and cleanup
- teardown_method / One way to do setup and cleanup
- setup_class method / One way to do setup and cleanup
- teardown_class method / One way to do setup and cleanup
- setup_module method / One way to do setup and cleanup
- teardown_module method / One way to do setup and cleanup
- variables, setting up / A completely different way to set up variables
- test, skipping / Test skipping with py.test
- TestSuites / Organizing and running tests
- TextNode state / State example
- TimedEvent class / Functions are objects too
- Timer class / Functions are objects too
- title method / String manipulation
- Tk() object / TkInter
- TkInter
- tkinter.Frame class / TkInter
- top-down design / Exercises
- translate method / String manipulation
- tuples
- about / Tuples and named tuples
- functions / Tuples and named tuples
- creating / Tuples and named tuples
- unpacking / Tuples and named tuples
- uses / Tuples and named tuples
- TurboGears framework / A full web stack?
U
- undo method / Command pattern
- Unicode
- about / Strings are Unicode
- bytes, converting to text / Converting bytes to text
- text, converting to bytes / Converting text to bytes
- Unified Modeling Language (UML)
- about / Objects and classes
- union method / Sets
- unit testing
- about / Unit testing
- assertion methods / Assertion methods
- situations, testing / Reducing boilerplate and cleaning up
- tests, running / Organizing and running tests
- tests, organizing / Organizing and running tests
- broken tests, ignoring / Ignoring broken tests
- unittest library / Additional assertion methods in Python 3.1
- unittest module / Testing with py.test
- unit tests
- about / Unit testing
- unpacking arguments
- about / Unpacking arguments
- unzip method / Managing objects
- update() method / Observer pattern
- upper method / String manipulation
- urlparse function / Case study
V
- values
- about / Behaviors are actions
- varargs
- about / Variable argument lists
- variable argument lists
- about / Variable argument lists
W
- weakref module / Flyweight pattern
- WeakValueDictionary object / Flyweight pattern
- web objects
- serializing / Serializing web objects
- WebPage class / When should we use properties?
- Window.exit method / Command pattern
- Window class / Command pattern
- writelines method / File IO
- write method / File IO
- wxPython
- about / Choosing a GUI toolkit
X
Z
- zipfile module / Managing objects
- zip function
- about / Zip
- zip method / Managing objects
- zipprocessor object / Or we can use composition
- ZipReplace class / In practice