Extending Python's Number hierarchy

Published: 30 January 2023
on channel: mCoding
28,856
1.3k

Try Brilliant: https://brilliant.org/mCoding/

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 (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
Slots video:    • Python __slots__ and object layout ex...  
Fast pow video:    • Fast pow! A general recursive power a...  
New vs init video:    • __new__ vs __init__ in Python  
Python numbers docs: https://docs.python.org/3/library/num...
Python stdtypes docs: https://docs.python.org/3/library/std...

SUPPORT ME ⭐
---------------------------------------------------
Sign up on Patreon to get your donor role and early access to videos!
  / mcoding  

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

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

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

CHAPTERS
---------------------------------------------------
0:00 Intro
1:21 Start of implementation
4:00 Arithmetic operations
11:32 Hash and equality
15:13 Thanks to Brilliant


Watch video Extending Python's Number hierarchy online without registration, duration hours minute second in high quality. This video was added by user mCoding 30 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 28,856 once and liked it 1.3 thousand people.