LPTHW Exercises 46-49
(12/16/2013 -- 6:30pm EST)
Python in the Real World
Exercise 46: Skeleton Project
How do we create Python packages (hint: __init__.py)?
What is setup.py and how does it work?
How about these:
- pip
- distribute
- nose
- virtualenv (and virtualenvwrapper)
exercise 47: Automated TEsting
When you write new code, you should also write tests
These tests should confirm that the code works as expected
Why test?
- Correctness
- Convenience
- Regression
Exercise 48: Exceptions
What happens when programs encounter runtime errors?
Can we capture (or prevent) these errors
and prevent program crashes? The answer is YES!
If we "catch" errors in our code, we can suppress them
Try/Except blocks
exercise 49: Exception Practice
See raise_exception_example.py
Notice the code that raises an exception