The power of Special Methods in Python. Make better classes!
Learn Python’s datamodel with operator overloading and emulate built-in types by implementing magic (dunder) methods

The power of Special Methods in Python. Make better classes! udemy course free download
Learn Python’s datamodel with operator overloading and emulate built-in types by implementing magic (dunder) methods
People say that python is an intuitive language to learn and use. Beginners write their first programs in no time and more advanced programmers make educated guesses how to use parts of Python they have never used before. Even third-party libraries seem to work exactly how you expected.
80% of our time we are using operators like +-/* to calculate, use for-loops to go through lists, use len() to count and indexers to access elements from lists. After a while you don't even have to think about these language features anymore. You just use them and expect things to work the same way everywhere.
But why and how does this work?
In this course, you learn how to design your classes and objects to support common language features so other programmers can make smart guesses about how to use them. You learn how to support iteration, subscripting (indexing), context managers, hashing, equality checking etc.
After this course, you are able to:
- Explain the origin of the names Python datamodel, magic methods, dunder methods and special methods.
- Write an indexer to support subscripting with the __getitem__ method
- Apply __iter__, __next__ to make your objects iterable
- Define the object identity
- Use __hash__ to make objects hashable
- Specify language featureswith special methods __eq__, __ne__, __lt__, __gt__, __le__, __ge__
- Make objects callable with __call__
- Describe how objects are constructed by methods __new__ and __init__
- Wrap existing code into context managers with __enter__ and __exit__
The length of this course is 2 hours. Each topic shows clear examples of how to make your classes more Pythonic by implementing special methods, the secret weapon of your objects. This course has no exercises.
This course is meant for developer with basic Python experience who want to improve their skills or developers who bring experience from another language like c#, java, javascript, c++ and want to learn about Pythons unique language features.
This course is taught by Loek van den Ouweland, a senior software engineer with 25 years of experience. Loek is the creator of Wunderlist for windows, Microsoft To-do and Mahjong for Windows and has 15 years of experience teaching software engineering to a wide variety of students.