filmov
tv
super/MRO, Python's most misunderstood feature.

Показать описание
Python's super does NOT mean "parent".
It means "next in line". What line? The Method Resolution Order (MRO) of an object, which defines the search order for attribute lookups. super() uses some very sneaky techniques, such as examining the current stack frame, and object proxying. All this is explained in great detail, for both single and multiple inheritance, and a pure Python implementation of super is given.
CONTEST CURRENTLY CLOSED! THE WINNERS HAVE BEEN CONTACTED, CHECK YOUR COMMENT TO SEE!
OFFICIAL CONTEST RULES:
2. YouTube is not a sponsor of the contest and viewers are required to release YouTube from any liability related to the contest.
3. Privacy notice: no personal data will be collected for this contest.
4. In order to enter, you must (a) be one of my subscribers, AND (b) make a top-level comment to the video including #pycharm or #clion somewhere in the comment.
5. The contest is free, there is no fee required to enter.
6. Winners will be chosen randomly 1 week after the date the video went live from all users who have entered and not been disqualified.
7. Each winner will be notified via a comment reply from me that details what prize was won (e.g. "Congratulations! You have won XYZ. Please email me."). I will ask the winner to contact me by email, and I will reply through email with a random token which must be posted as another reply to the winning comment from the winning account in order to verify account ownership and prevent fraud.
8. Each winner will have 72 hours to respond AND prove account ownership or their prize is automatically forfeited and another winner will be chosen.
9. A winner can only win 1 prize per contest.
11. You may not enter the contest if doing so would be a violation of any relevant federal, state, and local laws, rules, and regulations, including U.S. sanctions.
SUPPORT ME ⭐
---------------------------------------------------
Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G
BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
CHAPTERS
---------------------------------------------------
0:00 Intro
0:32 Basic super usage
2:34 super does NOT call your parent
4:29 Method Resolution Order (MRO)
6:18 super means "next in line"
6:48 How MRO is determined
8:07 How to design with super
12:01 How does Python super work?
16:53 Two-argument super
18:01 One-argument super
18:18 Implementing super in Python
It means "next in line". What line? The Method Resolution Order (MRO) of an object, which defines the search order for attribute lookups. super() uses some very sneaky techniques, such as examining the current stack frame, and object proxying. All this is explained in great detail, for both single and multiple inheritance, and a pure Python implementation of super is given.
CONTEST CURRENTLY CLOSED! THE WINNERS HAVE BEEN CONTACTED, CHECK YOUR COMMENT TO SEE!
OFFICIAL CONTEST RULES:
2. YouTube is not a sponsor of the contest and viewers are required to release YouTube from any liability related to the contest.
3. Privacy notice: no personal data will be collected for this contest.
4. In order to enter, you must (a) be one of my subscribers, AND (b) make a top-level comment to the video including #pycharm or #clion somewhere in the comment.
5. The contest is free, there is no fee required to enter.
6. Winners will be chosen randomly 1 week after the date the video went live from all users who have entered and not been disqualified.
7. Each winner will be notified via a comment reply from me that details what prize was won (e.g. "Congratulations! You have won XYZ. Please email me."). I will ask the winner to contact me by email, and I will reply through email with a random token which must be posted as another reply to the winning comment from the winning account in order to verify account ownership and prevent fraud.
8. Each winner will have 72 hours to respond AND prove account ownership or their prize is automatically forfeited and another winner will be chosen.
9. A winner can only win 1 prize per contest.
11. You may not enter the contest if doing so would be a violation of any relevant federal, state, and local laws, rules, and regulations, including U.S. sanctions.
SUPPORT ME ⭐
---------------------------------------------------
Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G
BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
CHAPTERS
---------------------------------------------------
0:00 Intro
0:32 Basic super usage
2:34 super does NOT call your parent
4:29 Method Resolution Order (MRO)
6:18 super means "next in line"
6:48 How MRO is determined
8:07 How to design with super
12:01 How does Python super work?
16:53 Two-argument super
18:01 One-argument super
18:18 Implementing super in Python
Комментарии