6 Python in Bigger Projects

WHAT YOU WILL LEARN IN THIS CHAPTER:    

  • Testing your Python code
  • Debugging your Python code
  • Handling errors in your Python code
  • Structuring and releasing your Python code
  • Tuning the performance of your Python code

WROX.COM DOWNLOADS FOR THIS CHAPTER

You can find the wrox.com downloads for this chapter at www.wrox.com/go/pythonprojects on the Download Code tab. The code is in the Chapter 6 download, called Chapter 6.zip, and individually named according to the names throughout the chapter.

So far you’ve looked at many ways to use Python. You’ve made local scripts to handle small tasks, you’ve handled medium-sized tasks locally, and you’ve even made a small web app using Flask. But what if you find yourself in the midst of a larger project? Python, as you have seen by now, is a very powerful language. It’s also very open, meaning you, the developer, have access to all aspects of the language. This openness, however, makes testing your Python code more important than ever. Every object in Python is a first-class object, so you can change and manipulate any object available to you. Because you can change and manipulate objects, you must make sure to test and verify the logic of our code.

Python is not a “typed” language in the same way that C and Java are explicitly typed. You can pass objects around in Python and the interpreter will try to manipulate them to the best of its ability. If it cannot perform an operation on an object or data that is ...

Get Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.