Extending Python’s Number hierarchy

Try Brilliant: Complex rational numbers. Say you wanted to implement your own custom number type in Python, how would you do it? In this video, we’ll take a look at a custom implementation of an infinite precision number type for complex numbers with rational components, aka “Gaussian rationals“. ― mCoding with James Murphy () Source code: Slots video: Fast pow video: New vs init video: Python numbers docs: Python stdtypes docs: SUPPORT ME ⭐ --------------------------------------------------- Sign up on Patreon to get your donor role and early access to videos! Feeling generous but don’t have a Patreon? Donate via PayPal! (No sign up needed.) Want to donate crypto? Check out the rest of my supported donations on my website! Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, Neel R, Matt R, Johan A, Casey G, Mark M, Mutual Information BE ACTIVE IN MY COMMUNITY 😄 --------------------------------------------------- Discord: Github: Reddit: Facebook: CHAPTERS --------------------------------------------------- 0:00 Intro 1:21 Start of implementation 4:00 Arithmetic operations 11:32 Hash and equality 15:13 Thanks to Brilliant
Back to Top