Does Python allow access to some of the implementation details?

Carl Friedrich Bolz cfbolz at gmx.de
Sat Jan 7 13:39:43 EST 2006


Paul Rubin wrote:
> Claudio Grondi <claudio.grondi at freenet.de> writes:
> 
>>The question is if Python allows somehow access to the bytes of the
>>representation of a long integer or integer in computers memory?
> 
> 
> No it doesn't, and that's a good thing, since the internal
> representation is a little bit surprising (it stores 15 bits of the
> long int in each 16-bit word of the representation, to make the
> arithmetic routines  a little simpler).
> 

Indeed. There are even more reasons why this is a Good Thing (tm) (not 
only because the internal representation is surprising). Basically it 
gives the implementor of a Python interpreter the freedom to choose the 
internal representation that he deems to be the most fitting. If 
implementation details leaked outside that wouldn't be possible anymore.

Cheers,

Carl Friedrich Bolz




More information about the Python-list mailing list