Python's collections.abc | InvertibleDict



Python's collections.abc | InvertibleDict

Python's collections.abc | InvertibleDict

Learn your ABCs!

That’s Abstract Base Classes, by the way. Python provides a standard set of interfaces for abstract collections that are widely used. They come in the collections.abc module and can be used for type hinting purposes, runtime interface checking, as well as being usable as base classes to define many interface functions based on just a few. For instance, if you define __getitem__, __iter__ and __len__, then Python can automatically define the rest of the Mapping interface functions __contains__, keys, items, values, get, __eq__, and __ne__ by using the ones you provided. We demonstrate abstract collections by implementing an invertible dictionary class that is a MutableMapping.

CONTEST CURRENTLY CLOSED! Thanks for playing!

OFFICIAL CONTEST RULES:
1. All entries must comply with the YouTube community guidelines ( http://www.youtube.com/t/community_guidelines) and YouTube Terms of Service (http://www.youtube.com/static?gl=US&template=terms). Entries that violate YouTube guidelines are automatically disqualified.
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 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.
10. The prize pool for this contest is: 2 licenses (“Free 1-Year Personal Subscription”) to any of these JetBrains IDEs: AppCode, CLion, DataGrip, DataSpell, GoLand, IntelliJ IDEA Ultimate, PhpStorm, PyCharm, ReSharper, ReSharper C++, Rider, RubyMine, WebStorm, or dotUltimate. A prize consists of 1 license, which will be delivered in the form of a redeemable code that can be redeemed at https://www.jetbrains.com/store/redeem/ before July 17, 2023.
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.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosSampleCode
collections.abc docs: https://docs.python.org/3/library/collections.abc.html
slots video: https://www.youtube.com/watch?v=Iwf17zsDAnY

SUPPORT ME ⭐
—————————————————
Sign up on Patreon to get your donor role and early access to videos!
https://patreon.com/mCoding

Feeling generous but don’t have a Patreon? Donate via PayPal! (No sign up needed.)
https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE

Want to donate crypto? Check out the rest of my supported donations on my website!
https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, Neel R, Matt R, Johan A, Casey G, Mark M, Mutual Information, Pi

BE ACTIVE IN MY COMMUNITY 😄
—————————————————
Discord: https://discord.gg/Ye9yJtZQuN
Github: https://github.com/mCodingLLC/
Reddit: https://www.reddit.com/r/mCoding/
Facebook: https://www.facebook.com/james.mcoding

CHAPTERS
—————————————————
0:00 Intro
0:35 All the ABCs
2:28 Type hinting
4:03 Runtime Interface Checking
5:38 InvertibleDict
13:44 Outro

Comments are closed.