Extending Python's Number hierarchy
mCoding mCoding
225K subscribers
28,632 views
0

 Published On Jan 30, 2023

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

show more

Share/Embed