I am learning Python and how to make classes. I was curious how the classes are made inside Python itself! For example, in datetime.py (I find it by googling) I was checking how they used __add__
or __sub__
which is using "if isinstance(other, timedelta):" that was an interesting learning. Also, I am learning what professionally written programs look like.
My question is how can I find the source codes of internal classes and functions inside Python, for example, I am interested to see how they implement add in print()
, that can print(1+2)
-> 3 and
print('a'+'b')
-> ab