Home Page Icon
Home Page
Table of Contents for
Index
Close
Index
by Fabrizio Romano
Learning Python
Learning Python
Table of Contents
Learning Python
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction and First Steps – Take a Deep Breath
A proper introduction
Enter the Python
About Python
Portability
Coherence
Developer productivity
An extensive library
Software quality
Software integration
Satisfaction and enjoyment
What are the drawbacks?
Who is using Python today?
Setting up the environment
Python 2 versus Python 3 – the great debate
Installing Python
Setting up the Python interpreter
About virtualenv
Your first virtual environment
Your friend, the console
How you can run a Python program
Running Python scripts
Running the Python interactive shell
Running Python as a service
Running Python as a GUI application
How is Python code organized
How do we use modules and packages
Python's execution model
Names and namespaces
Scopes
Object and classes
Guidelines on how to write good code
The Python culture
A note on the IDEs
Summary
2. Built-in Data Types
Everything is an object
Mutable or immutable? That is the question
Numbers
Integers
Booleans
Reals
Complex numbers
Fractions and decimals
Immutable sequences
Strings and bytes
Encoding and decoding strings
Indexing and slicing strings
Tuples
Mutable sequences
Lists
Byte arrays
Set types
Mapping types – dictionaries
The collections module
Named tuples
Defaultdict
ChainMap
Final considerations
Small values caching
How to choose data structures
About indexing and slicing
About the names
Summary
3. Iterating and Making Decisions
Conditional programming
A specialized else: elif
The ternary operator
Looping
The for loop
Iterating over a range
Iterating over a sequence
Iterators and iterables
Iterating over multiple sequences
The while loop
The break and continue statements
A special else clause
Putting this all together
Example 1 – a prime generator
Example 2 – applying discounts
A quick peek at the itertools module
Infinite iterators
Iterators terminating on the shortest input sequence
Combinatoric generators
Summary
4. Functions, the Building Blocks of Code
Why use functions?
Reduce code duplication
Splitting a complex task
Hide implementation details
Improve readability
Improve traceability
Scopes and name resolution
The global and nonlocal statements
Input parameters
Argument passing
Assignment to argument names don't affect the caller
Changing a mutable affects the caller
How to specify input parameters
Positional arguments
Keyword arguments and default values
Variable positional arguments
Variable keyword arguments
Keyword-only arguments
Combining input parameters
Avoid the trap! Mutable defaults
Return values
Returning multiple values
A few useful tips
Recursive functions
Anonymous functions
Function attributes
Built-in functions
One final example
Documenting your code
Importing objects
Relative imports
Summary
5. Saving Time and Memory
map, zip, and filter
map
zip
filter
Comprehensions
Nested comprehensions
Filtering a comprehension
dict comprehensions
set comprehensions
Generators
Generator functions
Going beyond next
The yield from expression
Generator expressions
Some performance considerations
Don't overdo comprehensions and generators
Name localization
Generation behavior in built-ins
One last example
Summary
6. Advanced Concepts – OOP, Decorators, and Iterators
Decorators
A decorator factory
Object-oriented programming
The simplest Python class
Class and object namespaces
Attribute shadowing
I, me, and myself – using the self variable
Initializing an instance
OOP is about code reuse
Inheritance and composition
Accessing a base class
Multiple inheritance
Method resolution order
Static and class methods
Static methods
Class methods
Private methods and name mangling
The property decorator
Operator overloading
Polymorphism – a brief overview
Writing a custom iterator
Summary
7. Testing, Profiling, and Dealing with Exceptions
Testing your application
The anatomy of a test
Testing guidelines
Unit testing
Writing a unit test
Mock objects and patching
Assertions
A classic unit test example
Making a test fail
Interface testing
Comparing tests with and without mocks
Boundaries and granularity
A more interesting example
Test-driven development
Exceptions
Profiling Python
When to profile?
Summary
8. The Edges – GUIs and Scripts
First approach – scripting
The imports
Parsing arguments
The business logic
Second approach – a GUI application
The imports
The layout logic
The business logic
Fetching the web page
Saving the images
Alerting the user
How to improve the application?
Where do we go from here?
The tkinter.tix module
The turtle module
wxPython, PyQt, and PyGTK
The principle of least astonishment
Threading considerations
Summary
9. Data Science
IPython and Jupyter notebook
Dealing with data
Setting up the notebook
Preparing the data
Cleaning the data
Creating the DataFrame
Unpacking the campaign name
Unpacking the user data
Cleaning everything up
Saving the DataFrame to a file
Visualizing the results
Where do we go from here?
Summary
10. Web Development Done Right
What is the Web?
How does the Web work?
The Django web framework
Django design philosophy
The model layer
The view layer
The template layer
The Django URL dispatcher
Regular expressions
A regex website
Setting up Django
Starting the project
Creating users
Adding the Entry model
Customizing the admin panel
Creating the form
Writing the views
The home view
The entry list view
The form view
Tying up URLs and views
Writing the templates
The future of web development
Writing a Flask view
Building a JSON quote server in Falcon
Summary
11. Debugging and Troubleshooting
Debugging techniques
Debugging with print
Debugging with a custom function
Inspecting the traceback
Using the Python debugger
Inspecting log files
Other techniques
Profiling
Assertions
Where to find information
Troubleshooting guidelines
Using console editors
Where to inspect
Using tests to debug
Monitoring
Summary
12. Summing Up – A Complete Example
The challenge
Our implementation
Implementing the Django interface
The setup
The model layer
A simple form
The view layer
Imports and home view
Listing all records
Creating records
Updating records
Deleting records
Setting up the URLs
The template layer
Home and footer templates
Listing all records
Creating and editing records
Talking to the API
Deleting records
Implementing the Falcon API
The main application
Writing the helpers
Coding the password validator
Coding the password generator
Writing the handlers
Coding the password validator handler
Coding the password generator handler
Running the API
Testing the API
Testing the helpers
Testing the handlers
Where do you go from here?
Summary
A word of farewell
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
A word of farewell
Index
A
ad hoc polymorphism
about /
Polymorphism – a brief overview
AJAX
about /
The future of web development
,
The template layer
Anaconda
URL /
Where do we go from here?
anonymous functions
about /
Anonymous functions
API
testing /
Testing the API
helpers, testing /
Testing the helpers
handlers, testing /
Testing the handlers
application
testing /
Testing your application
application programming interface (API)
about /
Writing a unit test
assertion
about /
Assertions
B
Base64
about /
The imports
base class
about /
Inheritance and composition
binary search
about /
Where to inspect
Bitbucket
URL /
Exceptions
black-box tests
about /
Testing your application
Bokeh
URL /
Where do we go from here?
boundaries
about /
A specialized else: elif
boundary
about /
Boundaries and granularity
built-in exceptions hierarchy
URL /
Exceptions
built-in functions
about /
Built-in functions
built-in scope
about /
Scopes
business logic, GUI application
web page, fetching /
The business logic
,
Fetching the web page
images, saving /
Saving the images
user, alerting /
Alerting the user
C
callback
about /
The layout logic
campaign
about /
Preparing the data
classes
about /
Object and classes
,
Object-oriented programming
class methods
about /
Class methods
code
writing, guidelines /
Guidelines on how to write good code
documenting /
Documenting your code
collections module
about /
The collections module
named tuples /
Named tuples
defaultdict /
Defaultdict
ChainMap /
ChainMap
comma-separated values (CSV)
about /
Saving the DataFrame to a file
command prompt
about /
Setting up the Python interpreter
composition
about /
Inheritance and composition
comprehensions
about /
map, zip, and filter
,
Comprehensions
nested comprehensions /
Nested comprehensions
filtering /
Filtering a comprehension
dict comprehensions /
dict comprehensions
set comprehensions /
set comprehensions
and generators /
Don't overdo comprehensions and generators
conditional programming
about /
Conditional programming
elif /
A specialized else: elif
ternary operator /
The ternary operator
considerations
threading /
Threading considerations
console
about /
Setting up the Python interpreter
,
Your friend, the console
constructor
about /
Initializing an instance
container datatypes
defining /
The collections module
context manager
using /
The business logic
context object
preparing /
The template layer
cookies
about /
How does the Web work?
CPC (Cost Per Click)
about /
Unpacking the user data
CPI (Cost Per Impression)
about /
Unpacking the user data
Cron
about /
Running Python scripts
Cross-origin resource sharing (CORS)
about /
Talking to the API
cross-site request forgery (CSRF) attack
about /
Creating the form
CSS (Cascading Style Sheets)
about /
A regex website
CTR (Click Through Rate)
about /
Unpacking the user data
custom exceptions
writing /
Exceptions
custom iterator
writing /
Writing a custom iterator
cypertext
about /
The model layer
D
data
dealing with /
Dealing with data
notebook, setting up /
Setting up the notebook
preparing /
Preparing the data
cleaning /
Cleaning the data
DataFrame, creating /
Creating the DataFrame
DataFrame, saving to file /
Saving the DataFrame to a file
results, visualizing /
Visualizing the results
DataFrame
campaign name, unpacking /
Unpacking the campaign name
user data, unpacking /
Unpacking the user data
defining /
Cleaning everything up
data migrations
about /
Adding the Entry model
data structures
selecting /
How to choose data structures
debugging techniques
about /
Debugging techniques
debugging, with print /
Debugging with print
debugging, with custom function /
Debugging with a custom function
traceback, inspecting /
Inspecting the traceback
Python debugger, using /
Using the Python debugger
log files, inspecting /
Inspecting log files
profiling /
Profiling
assertions /
Assertions
information, finding /
Where to find information
decorate-sort-undecorate
about /
map
URL /
map
decoration
about /
Decorators
decoration point
about /
Decorators
decorator
about /
Decorators
decorator factory
about /
A decorator factory
decorators
about /
Decorators
default values
about /
Keyword arguments and default values
determinist profiling
about /
Profiling Python
diamond
about /
Multiple inheritance
dictionaries
about /
Mapping types – dictionaries
discounts
applying /
Example 2 – applying discounts
dispatcher
about /
Example 2 – applying discounts
Django
setting up /
Setting up Django
URL /
Setting up Django
project, starting /
Starting the project
users, creating /
Creating users
about /
Writing the templates
Django interface
implementing /
Our implementation
,
Implementing the Django interface
setup /
The setup
model layer /
The model layer
simple form /
A simple form
view layer /
The view layer
URLs, setting up /
Setting up the URLs
template layer /
The template layer
Django URL dispatcher
defining /
The Django URL dispatcher
regular expression /
Regular expressions
Django web framework
defining /
The Django web framework
model layer /
The model layer
view layer /
The view layer
template layer /
The template layer
docstrings
about /
Documenting your code
DRY (Don't Repeat Yourself) principle /
How do we use modules and packages
dunder
about /
Going beyond next
E
enclosing scope
about /
Scopes
entries
about /
Starting the project
environment
setting up /
Setting up the environment
equalities
about /
A specialized else: elif
Euclid's algorithm
about /
Don't overdo comprehensions and generators
Euclidean formula
about /
Don't overdo comprehensions and generators
exception
about /
A special else clause
exceptions
about /
Exceptions
execution model, Python
about /
Python's execution model
F
factorial
about /
How do we use modules and packages
Falcon
JSON quote server, building /
Building a JSON quote server in Falcon
about /
Building a JSON quote server in Falcon
URL /
Building a JSON quote server in Falcon
Falcon API
implementing /
Implementing the Falcon API
main application /
The main application
helpers, writing /
Writing the helpers
handlers, writing /
Writing the handlers
API, running /
Running the API
API, testing /
Testing the API
features, Python
portability /
Portability
coherence /
Coherence
developer productivity /
Developer productivity
extensive library /
An extensive library
software quality /
Software quality
software integration /
Software integration
satisfaction and enjoyment /
Satisfaction and enjoyment
Fibonacci sequence example
about /
One last example
filter
about /
map, zip, and filter
defining /
filter
Flask
URL /
Writing a Flask view
about /
Writing a Flask view
Flask view
writing /
Writing a Flask view
floating point numbers
URL /
Reals
form
about /
Creating the form
framework
about /
The Django web framework
function
about /
How do we use modules and packages
function attributes
about /
Function attributes
functions
using /
Why use functions?
code duplication, reducing /
Reduce code duplication
complex task, splitting /
Splitting a complex task
implementation details, hiding /
Hide implementation details
readability, improving /
Improve readability
traceability, improving /
Improve traceability
writing, tips /
A few useful tips
example /
One final example
G
generation behavior, in built-ins
about /
Generation behavior in built-ins
generator expressions
about /
Generator expressions
generator functions
about /
Generator functions
generator objects
about /
Going beyond next
generators
about /
map, zip, and filter
,
Generators
generator functions /
Generators
generator expressions /
Generators
and comprehensions /
Don't overdo comprehensions and generators
getter
about /
The property decorator
getters and setters
about /
The property decorator
Git
about /
Guidelines on how to write good code
GitHub
URL /
Exceptions
global scope
about /
Scopes
gray-box testing
about /
Testing your application
greatest common divisor (GCD)
about /
Don't overdo comprehensions and generators
Green phase
about /
Test-driven development
GUI (Graphical User Interface) /
Running Python as a GUI application
GUI application
Python, running as /
Running Python as a GUI application
about /
Second approach – a GUI application
imports /
Second approach – a GUI application
,
The imports
layout logic /
The layout logic
business logic /
The business logic
improving /
How to improve the application?
Gunicorn
URL /
Running the API
Gunicorn (Green Unicorn)
about /
Building a JSON quote server in Falcon
H
handlers
writing /
Writing the handlers
password validator handler, coding /
Coding the password validator handler
password generator handler, coding /
Coding the password generator handler
Hashability
about /
Set types
helpers
writing /
Writing the helpers
password validator, coding /
Coding the password validator
password generator, coding /
Coding the password generator
HTML Document Object Model (DOM)
about /
Creating the form
Hypertext Markup Language (HTML)
about /
The view layer
Hypertext Transfer Protocol (HTTP)
about /
What is the Web?
I
IDLE (Integrated DeveLopment Environment) /
Running the Python interactive shell
immutable
about /
A proper introduction
,
Mutable or immutable? That is the question
immutable sequences
about /
Immutable sequences
strings and bytes /
Strings and bytes
tuples /
Tuples
implicit concatenation
about /
Building a JSON quote server in Falcon
in-place
about /
Unpacking the user data
indexing
about /
About indexing and slicing
inequalities
about /
A specialized else: elif
infinite loop
about /
The while loop
inheritance
about /
Inheritance and composition
initializer
about /
Object and classes
,
Initializing an instance
inner
about /
A specialized else: elif
input parameters
about /
Input parameters
argument passing /
Argument passing
assignment, to argument names /
Assignment to argument names don't affect the caller
mutable, changing /
Changing a mutable affects the caller
specifying /
How to specify input parameters
positional arguments /
Positional arguments
keyword arguments /
Keyword arguments and default values
default values /
Keyword arguments and default values
variable positional arguments /
Variable positional arguments
variable keyword arguments /
Variable keyword arguments
keyword-only arguments /
Keyword-only arguments
, combining /
Combining input parameters
mutable defaults /
Avoid the trap! Mutable defaults
inside-out technique
about /
Iterating over a sequence
installing
Python /
Installing Python
instance attributes
about /
Class and object namespaces
instances of classes
about /
Object and classes
integer division (//)
about /
Integers
Integrated Development Environments (IDEs) /
A note on the IDEs
about /
The property decorator
interface testing
about /
Interface testing
Internet
about /
What is the Web?
ipdb library
about /
Using the Python debugger
IPython
URL /
Where do we go from here?
Ipython
about /
IPython and Jupyter notebook
URL /
IPython and Jupyter notebook
iterable
about /
Writing a custom iterator
iterator
about /
Iterators and iterables
,
Writing a custom iterator
itertools module
about /
A quick peek at the itertools module
infinite iterators /
Infinite iterators
terminating, on shortest input sequence /
Iterators terminating on the shortest input sequence
combinatoric generators /
Combinatoric generators
J
jQuery
about /
The template layer
URL /
The template layer
JSON (JavaScript Object Notation)
about /
Exceptions
JSON quote server
building, in Falcon /
Building a JSON quote server in Falcon
Jupyter notebook
about /
IPython and Jupyter notebook
URL /
IPython and Jupyter notebook
K
KeepassX
about /
The challenge
keyword-only parameter
about /
Keyword-only arguments
keyword arguments
about /
Keyword arguments and default values
L
lambdas
about /
Anonymous functions
library
about /
How do we use modules and packages
list comprehension
about /
Lists
local, enclosing, global, built-in (LEGB) /
Scopes
local scope
about /
Scopes
log files
about /
Inspecting log files
loggers /
Inspecting log files
handlers /
Inspecting log files
filters /
Inspecting log files
formatters /
Inspecting log files
logging
URL /
Inspecting log files
loop
iterating, over range /
Iterating over a range
iterating, over sequence /
Iterating over a sequence
looping
about /
Looping
for loop /
The for loop
iterators and iterables /
Iterators and iterables
iterating, over multiple sequences /
Iterating over multiple sequences
while loop /
The while loop
break and continue statements /
The break and continue statements
else clause /
A special else clause
M
magic method
about /
Object and classes
magic methods
about /
Going beyond next
map
about /
map, zip, and filter
defining /
map
markdown
about /
IPython and Jupyter notebook
master password
about /
The challenge
Matplotlib
URL /
Where do we go from here?
Mercurial
about /
Guidelines on how to write good code
merge and insertion sort
about /
Lists
metaclasses
about /
Object and classes
,
The simplest Python class
metaprogramming
about /
The simplest Python class
method
about /
Going beyond next
method resolution order (MRO)
about /
Method resolution order
methods
about /
A proper introduction
middleware class
about /
Writing the templates
migration
about /
Adding the Entry model
migrations
applying /
Starting the project
mixins
about /
Multiple inheritance
mocks
about /
Mock objects and patching
model
about /
The model layer
model-template-view (MTV) pattern
about /
Django design philosophy
model-view-controller (MVC)
about /
Django design philosophy
modules
using /
How do we use modules and packages
mutable
about /
A proper introduction
,
Mutable or immutable? That is the question
mutable sequences
about /
Mutable sequences
lists /
Lists
byte arrays /
Byte arrays
N
NameError exception /
Scopes
name localization
about /
Name localization
name mangling
about /
Private methods and name mangling
names
about /
Names and namespaces
defining /
About the names
namespaces
about /
Names and namespaces
nano
about /
Using console editors
negative indexing
about /
About indexing and slicing
nose-parameterized
URL /
A more interesting example
Numba
URL /
Where do we go from here?
numbers
about /
Numbers
integers /
Integers
booleans /
Booleans
real numbers /
Reals
complex numbers /
Complex numbers
fractions and decimals /
Fractions and decimals
Numeric Python
about /
Creating the DataFrame
NumPy
URL /
Where do we go from here?
O
object
defining /
Everything is an object
mutable /
Mutable or immutable? That is the question
immutable /
Mutable or immutable? That is the question
object-oriented programming
about /
Object-oriented programming
Python class /
The simplest Python class
class and object namespaces /
Class and object namespaces
attribute shadowing /
Attribute shadowing
self variable, using /
I, me, and myself – using the self variable
instance, initializing /
Initializing an instance
code, reusing /
OOP is about code reuse
inheritance and composition /
Inheritance and composition
base class, accessing /
Accessing a base class
multiple inheritance /
Multiple inheritance
method resolution order /
Method resolution order
class and static methods /
Static and class methods
private methods /
Private methods and name mangling
name mangling /
Private methods and name mangling
property decorator /
The property decorator
operator overloading /
Operator overloading
polymorphism /
Polymorphism – a brief overview
object-relational mapping (ORM)
about /
The model layer
objects
about /
A proper introduction
,
Object and classes
,
Object-oriented programming
importing /
Importing objects
relative imports /
Relative imports
one way encryption algorithm
about /
The model layer
one way hash function
about /
The model layer
operating system (OS)
about /
Portability
operator overloading
about /
Lists
,
Operator overloading
outer
about /
A specialized else: elif
P
package
about /
How is Python code organized
packages
using /
How do we use modules and packages
Pandas
URL /
Where do we go from here?
patching
about /
Mock objects and patching
URL /
A classic unit test example
pdb
about /
Using the Python debugger
PEP328
about /
Relative imports
performance considerations
about /
Some performance considerations
pivot table
about /
Visualizing the results
plaintext
about /
The model layer
polymorphism /
Polymorphism – a brief overview
primary key
about /
The model layer
,
Adding the Entry model
prime generator
about /
Example 1 – a prime generator
primitive
about /
Don't overdo comprehensions and generators
principle of least astonishment
about /
The principle of least astonishment
principles, Django web framework
DRY /
Django design philosophy
Loose coupling /
Django design philosophy
Less code /
Django design philosophy
Consistency /
Django design philosophy
profiling
about /
Exceptions
,
When to profile?
properties
about /
A proper introduction
protocols
about /
What is the Web?
pull protocol
about /
How does the Web work?
push protocol
about /
How does the Web work?
PyGTK
about /
Second approach – a GUI application
,
wxPython, PyQt, and PyGTK
PyPy
URL /
What are the drawbacks?
PyQt
about /
Second approach – a GUI application
,
wxPython, PyQt, and PyGTK
pytest
URL /
A more interesting example
Pythagorean triple
about /
Filtering a comprehension
Python
about /
Enter the Python
features /
About Python
,
Software integration
drawbacks /
What are the drawbacks?
users /
Who is using Python today?
installing /
Installing Python
references /
Setting up the Python interpreter
running, as service /
Running Python as a service
running, as GUI application /
Running Python as a GUI application
execution model /
Python's execution model
profiling /
Profiling Python
Python 2
versus Python 3 /
Python 2 versus Python 3 – the great debate
Python code
organizing /
How is Python code organized
Python culture
about /
The Python culture
Python Enhancement Proposal (PEP) /
Guidelines on how to write good code
Python interactive shell
running /
Running the Python interactive shell
Python interpreter
setting up /
Setting up the Python interpreter
Python module
reference /
Everything is an object
Python Package Index (PyPI) /
An extensive library
Python program
running /
How you can run a Python program
Python scripts
running /
Running Python scripts
Q
quality assurance (QA)
about /
Testing your application
R
radix-64
about /
The imports
recursive functions
about /
Recursive functions
Red phase
about /
Test-driven development
Refactor
about /
Test-driven development
regex website
defining /
A regex website
Django, setting up /
Setting up Django
Entry model, adding /
Adding the Entry model
admin panel, customizing /
Customizing the admin panel
form, creating /
Creating the form
views, writing /
Writing the views
URLs and views, using /
Tying up URLs and views
templates, writing /
Writing the templates
regular expression /
Regular expressions
relational database
about /
The model layer
relative imports
URL /
Relative imports
request-response client-server protocol
about /
How does the Web work?
return values
about /
Return values
multiple values, returning /
Returning multiple values
S
scheduler
about /
Threading considerations
schema migration
about /
Adding the Entry model
Schwartzian transform
about /
map
Scikit-Learn
URL /
Where do we go from here?
SciPy
URL /
Where do we go from here?
scopes
about /
Scopes
local /
Scopes
enclosing /
Scopes
global /
Scopes
built-in /
Scopes
scopes and name resolution
defining /
Scopes and name resolution
global and nonlocal statements /
The global and nonlocal statements
scripting
about /
First approach – scripting
imports /
First approach – scripting
,
The imports
arguments, parsing /
Parsing arguments
business logic /
The business logic
service
Python, running as /
Running Python as a service
service-oriented architecture (SOA)
about /
Inspecting log files
service-oriented architectures
about /
Inspecting log files
setter
about /
The property decorator
set types
about /
Set types
Single-Page Application (SPA)
about /
The future of web development
Single Responsibility Principle (SRP)
about /
Writing the helpers
slicing
about /
About indexing and slicing
small values caching
about /
Small values caching
space
about /
Some performance considerations
Sphinx
about /
Documenting your code
SQL (Structured Query Language)
about /
The model layer
static methods
about /
Static methods
statistical profiling
about /
Profiling Python
strings
encoding /
Encoding and decoding strings
decoding /
Encoding and decoding strings
indexing /
Indexing and slicing strings
slicing /
Indexing and slicing strings
str objects
about /
Strings and bytes
symmetric encryption algorithm
about /
The model layer
system-exiting exceptions
about /
Exceptions
T
Tcl (Tool Command Language) /
Running Python as a GUI application
TCP/IP (Transmission Control Protocol/Internet Protocol)
about /
How does the Web work?
template layer
about /
The template layer
home and footer templates /
Home and footer templates
records, listing /
Listing all records
records, creating /
Creating and editing records
records, editing /
Creating and editing records
API, defining /
Talking to the API
records, deleting /
Deleting records
terminal
about /
Setting up the Python interpreter
ternary operator
about /
The ternary operator
test
defining /
The anatomy of a test
preparation /
The anatomy of a test
execution /
The anatomy of a test
verification /
The anatomy of a test
failing /
Making a test fail
test-driven development (TDD)
about /
Test-driven development
benefits /
Test-driven development
disadvantages /
Test-driven development
testing guidelines
defining /
Testing guidelines
tests
front-end tests /
Testing your application
scenario tests /
Testing your application
integration tests /
Testing your application
smoke tests /
Testing your application
Acceptance tests /
Testing your application
functional tests /
Testing your application
destructive tests /
Testing your application
performance tests /
Testing your application
usability tests /
Testing your application
security and penetration tests /
Testing your application
unit tests /
Testing your application
regression tests /
Testing your application
comparing, with mocks /
Comparing tests with and without mocks
comparing, without mocks /
Comparing tests with and without mocks
boundaries /
Boundaries and granularity
granularity /
Boundaries and granularity
example /
A more interesting example
thread
about /
Threading considerations
time
about /
Some performance considerations
Timsort
about /
Lists
Tk /
Running Python as a GUI application
tkinter
about /
Second approach – a GUI application
Tkinter /
Running Python as a GUI application
tkinter.tix (Tk Interface Extension) module
about /
The tkinter.tix module
tkinter.tix module
about /
The tkinter.tix module
Tk interface
about /
Second approach – a GUI application
triangulation
about /
Comparing tests with and without mocks
troubleshooting guidelines
about /
Troubleshooting guidelines
console editors, using /
Using console editors
inspecting /
Where to inspect
tests used, for debugging /
Using tests to debug
monitoring /
Monitoring
true division (/)
about /
Integers
tuple
about /
Tuples
turtle module
about /
The turtle module
U
unicode code points
about /
Strings and bytes
Uniform Resource Locator (URL)
about /
The Django URL dispatcher
unit test
about /
Unit testing
writing /
Writing a unit test
mock objects /
Mock objects and patching
patching /
Mock objects and patching
assertions /
Assertions
example /
A classic unit test example
unit testing
defining /
Unit testing
unpacking
about /
Variable positional arguments
Upcasting
about /
Booleans
user acceptance testing (UAT)
about /
Testing your application
user experience (UX)
about /
Testing your application
Utf-8
about /
Encoding and decoding strings
V
view layer
about /
The view layer
imports and home view /
Imports and home view
records, listing /
Listing all records
records, creating /
Creating records
records, updating /
Updating records
records, deleting /
Deleting records
views
writing /
Writing the views
home view /
The home view
entry list view /
The entry list view
form view /
The form view
vim
about /
Using console editors
virtualenv
about /
About virtualenv
reference link /
About virtualenv
virtual environment
creating /
Your first virtual environment
W
wasted time
about /
About the names
Web (World Wide Web)
defining /
What is the Web?
working /
How does the Web work?
web development
defining /
The future of web development
web framework
about /
The Django web framework
white-box tests
about /
Testing your application
wxPython
about /
Second approach – a GUI application
,
wxPython, PyQt, and PyGTK
Y
yield from expression
about /
The yield from expression
Z
zip
about /
map, zip, and filter
defining /
zip
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset