Search for tag: "error"

Zoom Nov. 12. Dynamic Typing

Our last presentation on classes reviews the issue of typing, and why this has become much trickier with the introduction of subclasses. This is the last material covered in the second exam.The…

From  Hannah Lee on November 12th, 2020 14 plays

Lesson 26.7 Convergent While-Loops

In this video we show one of the most powerful while-loop techniques: computing to convergence. Convergence is a concept that most students learn in Calculus, and so we will use a little Calculus in…

From  Hannah Lee on November 12th, 2020 19 plays

Lesson 25.6 Complex Custom Error Types

When we were recording the video on custom error types, it ran quite long. So we decided to break it up into a second video. In this video we look at a slightly more complicated error type. We also…

From  Hannah Lee on November 12th, 2020 30 plays

Lesson 25.5 Custom Error Types

Now that we can raise an error of any type, it is time to make our own error types. In this video we show that this is incredibly simple, and needs almost no code.

From  Hannah Lee on November 12th, 2020 31 plays

Lesson 25.4 The raise Statement

Up until now, the only way that we knew how to create an error is with an assert statement. But these always create errors with the type AssertionError. In this video we show how to create errors…

From  Hannah Lee on November 12th, 2020 34 plays

Lesson 25.3 Error Types and the Call Stack

After the last video, try-except looks less like an if-else statement and more like an if-elif-else statement. As we see in this video, this has profound effects on how errors interact with the call…

From  Hannah Lee on November 12th, 2020 35 plays

Lesson 25.2 Error-Specific Recovery

In this video we show how to use the error type to give you more control over a try-except statement. You can chose to recover from some errors, while completely ignoring other errors.

From  Hannah Lee on November 12th, 2020 36 plays

Lesson 25.1 Error Types

In this video we revisit error messages in Python and show how to read the error type. This type is a class, which means that you can construct your own error objects.

From  Hannah Lee on November 12th, 2020 38 plays

Lesson 24.1 Strict Typing

Whenever we have enforced preconditions, we have always used the type function. In this video we show why that is a problem, particularly when we want to use an object argument that is a subclass of…

From  Hannah Lee on November 12th, 2020 25 plays

Lesson 22.5 Name Resolution

We have long said that the dot (.) in Python means “inside of the folder”. But which folder? In this video, we show why subclasses makes this question a little less clear. When Python…

From  Hannah Lee on November 8th, 2020 26 plays

Lesson 21.6 Immutable Attributes

Getters and setters have another advantage in that they allow us to completely disable to any changes to an attribute. This allows us to separate attributes into mutable and immutable attributes,…

From  Hannah Lee on October 30th, 2020 44 plays

Lesson 20.8 The None Value

We have seen the None value used in several previous videos. But in this video we finally introduce it formally. In particular, we show why it is so commonly used in object initialization.

From  Hannah Lee on October 27th, 2020 34 plays

Lesson 20.5 Method Definitions

In addition to attributes, objects also have methods. In this video, we show how to add a method definition to a class. For the most part, it is as simple as indenting a function definition inside of…

From  Hannah Lee on October 27th, 2020 37 plays

Lesson 20.3 Classes and Attributes

The primary role of an object is to store attribute variables. In this video we demonstrate the easiest way to add attributes to an object. We see that we can also add attributes to class folders as…

From  Hannah Lee on October 27th, 2020 37 plays

Lesson 19.2 Dictionary Assignment

Dictionaries are mutable. In this video we show how to alter there contents. This includes reassigning the value of a dictionary for a given key. But it also includes adding and deleting keys.

From  Hannah Lee on October 27th, 2020 26 plays

Lesson 17.3 Recursion and the Call Stack

Because a recursive function calls itself, it will have multiple call frames on the call stack. In this video we show exactly why we should be concerned about this and why it will affect our function…

From  Hannah Lee on October 19th, 2020 41 plays