The addition of two numbers in Python is fascinating ⚡
Python literally does what we are taught in school. Go digit by digit and maintain a carry.
But, instead of working on decimal digits, python stores the number in base 2^31 and adds them digit by digit. This is how it supports infinitely long numbers with ease while being efficient.
If you are interested, do go through the source code of CPython, one of the best codebases out there https://lnkd.in/gs9cd9SM
⚡ I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.
arpitbhayani.me/course