PLEASE SUBSCRIBE!!!
In the previous video ( • Python Programming: Lesson 66 - Froze... ), we brought up the notion of a frozen dictionary. It's a collection of key-value pairs that's immutable:
1. unlike a regular dictionary, we cannot add key-value pairs
2. unlike a regular dictionary, we cannot remove key-value pairs
3. unlike a regular dictionary, we cannot change the values associated with keys
However, we can do everything else, and we define each behavior using an appropriate instance method (some of them are magic methods)
1. len
2. add
3. contains
...
In this video, we further explore frozen dictionaries. We review inheritance ( • Python Programming: Lesson 34 - Inher... ) by creating a subclass of our frozenDict class. The only difference between the superclass and subclass is that the subclass is callable because it supplies a call magic method. This allows us to treat callable frozen dictionaries like functions, but not traditional frozen dictionaries. In Python, callable(x) accepts an input x and returns True if and only if either of the following hold:
1. x is a function
2. x is an instance of a class that has a call magic method
0:41 Review of exec(x), iter(x), and eval(x)
3:40 Review of JSON
6:46 Review of Frozen Dictionaries
13:14 NEW: The Callable Function
Have you ever heard of a hexadecimal number? Check out hex numbers in Python, more content ahead! • Python Programming: Lesson 68 - Hexad...
Thanks for watching, and PLEASE SUBSCRIBE!!!
Смотрите видео Python Programming: Lesson 67 - The Callable Function онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал youmils03 21 Ноябрь 2021. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 86 раз и оно понравилось 1 посетителям.