Book Image

Sage Beginner's Guide

By : Craig Finch
1 (1)
Book Image

Sage Beginner's Guide

1 (1)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 9. Learning Advanced Python Programming

In Chapter 4, we learned about the basic elements of Python programming that you need to use Sage effectively. Throughout the following chapters, we saw various examples of objects in Sage, such as the ode_solver object we used in the last chapter. In this chapter, you will learn how to define your own classes to create custom objects. Objects are a way to bundle data and algorithms together to help you keep your code organized. You will also learn to handle runtime errors in your programs by using exceptions. Finally, you will learn how unit testing can help you avoid bugs in your code. Many of the concepts in this chapter are used by software engineers on large projects. It might seem to be "overkill" to use these principles on the short scripts you have been writing, but short scripts tend to grow into long programs. A little bit of discipline early in the programming process can save a lot of time later on.

In this chapter, you will learn...