[Python-Dev] PEP: Adding data-type objects to Python

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 31 00:43:11 CET 2006

Travis Oliphant wrote:

> The 'bit' type re-intprets the size information to be in units of "bits" 
> and so implies a "bit-field" instead of another data-format.

Hmmm, okay, but now you've got another orthogonality
problem, because you can't distinguish between e.g.
a 5-bit signed int field and a 5-bit unsigned int

It might be better not to consider "bit" to be a
type at all, and come up with another way of indicating
that the size is in bits. Perhaps

    'i4'   # 4-byte signed int
    'i4b'  # 4-bit signed int
    'u4'   # 4-byte unsigned int
    'u4b'  # 4-bit unsigned int

(Next we can have an argument about whether bit
fields should be packed MSB-to-LSB or vice versa...:-)


More information about the Python-Dev mailing list