filmov
tv
Learn Data Classes In python

Показать описание
Learn Data Classes In python.
In this video, we look at dataclasses in Python.
Data classes is a module that includes a decorator and procedures for adding generated special methods to user-defined classes, such as __init__() and __repr__().
Using dataclasses allows you create classes with less boiler plate code. It also allows you to write readable and maintainable code. In this video, we look at the concepts involved when using dataclasses using a simple example.
Timestamps:
00:00 Introduction
00:18 Creating the class normally
08:07 Creating the example class with dataclasses
11:19 Accessing all methods in a dataclass
14:07 Giving attributes default values
17:42 Custom representations of class attributes
21:23 The __post_init__ method
23:49 Frozen objects
27:40 Returning objects as dictionaries and tuples
30:24 Comparing objects and sorting them
35:11 Wrapping up
SOURCE CODE:
Please donate to this channel:
GITHUB:
TWITTER:
In this video, we look at dataclasses in Python.
Data classes is a module that includes a decorator and procedures for adding generated special methods to user-defined classes, such as __init__() and __repr__().
Using dataclasses allows you create classes with less boiler plate code. It also allows you to write readable and maintainable code. In this video, we look at the concepts involved when using dataclasses using a simple example.
Timestamps:
00:00 Introduction
00:18 Creating the class normally
08:07 Creating the example class with dataclasses
11:19 Accessing all methods in a dataclass
14:07 Giving attributes default values
17:42 Custom representations of class attributes
21:23 The __post_init__ method
23:49 Frozen objects
27:40 Returning objects as dictionaries and tuples
30:24 Comparing objects and sorting them
35:11 Wrapping up
SOURCE CODE:
Please donate to this channel:
GITHUB:
TWITTER: