filmov
tv
BCC21 - Intermediate Python Tutorial - Data Structures, Node Class, __slots__, 6.5 Minutes!

Показать описание
This video goes a bit deeper into navigating class boilerplate, dunder methods using dir() in interactive prompt. It also gives a high level explanation of why __slots__ is useful for creating a Node class and how it removes the __dict__ reference from the class.
Link To Follow Along File:
Link To Main Repo:
Covered Topics:
-dir(object) - outline of what comes boilerplate in classes due to ultimate inheritance from object class
-__slots__ use and how it replaces __dict__ to conserve on overall memory usage when large amounts of class instances are necessary.
-Node base class.
___________________________________________
0:00 // Introduction - Episode 21 - dir, __slots__
0:40 // How dir() shows you behind the scenes class info
0:58 // dunder methods, double underscore methods
1:54 // Existence of __dict__ in standard class instances
3:24 // __slots__ : set your variables once, stored on instance
4:29 // __slots__ : more memory efficient
4:38 // Wrap-Up
Link To Follow Along File:
Link To Main Repo:
Covered Topics:
-dir(object) - outline of what comes boilerplate in classes due to ultimate inheritance from object class
-__slots__ use and how it replaces __dict__ to conserve on overall memory usage when large amounts of class instances are necessary.
-Node base class.
___________________________________________
0:00 // Introduction - Episode 21 - dir, __slots__
0:40 // How dir() shows you behind the scenes class info
0:58 // dunder methods, double underscore methods
1:54 // Existence of __dict__ in standard class instances
3:24 // __slots__ : set your variables once, stored on instance
4:29 // __slots__ : more memory efficient
4:38 // Wrap-Up