views:

44

answers:

1

I just read through a PEP concerning the unification of ints and longs in Python3k in PEP 237. The approach used in this seems very interesting. The approach is to create a new type "integer" which is the abstract base class of int and long. Also, performing operations on ints which result in very large numbers will no longer result in an OverflowError, instead it'll return a long.

I'd like to see and try to understand the underlying implementation of this in Python3k. How should I go about that? Which files contain the details about "type" implementations?

So far I have only ventured out to read most of the non-C python stdlib modules; hence I am unclear on where exactly to look.

+1  A: 

Start with Include/longobject.h and Objects/longobject.h These paths are relative to the root of a Python source tree. Make sure to arm yourself with an editor suitable for browsing C code conveniently, or generate a HTML interlinked reference with GNU global.

Also, it would surely help to read this article on internals of objects in Python 3, as well as its sequel.

Eli Bendersky