A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-June/054362.html below:

[Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

[Python-Dev] Is PEP 237 final -- Unifying Long Integers and IntegersKeith Dart kdart at kdart.com
Sun Jun 19 10:25:55 CEST 2005
On Sun, 19 Jun 2005, Josiah Carlson wrote:

>
> Keith Dart <kdart at kdart.com> wrote:
>
>> Therefore, I would like to ask here if anyone has already started
>> something like this? If not, I will go ahead and do it (if I have time).
>
> If all you need to do is read or write C-like types to or from memory,
> you should spend some time looking through the 'struct' module if you
> haven't already.

I know about 'struct'. However, it will just convert to Python "native" 
types. C unsigned become Python longs.

  u = struct.pack("I", 0xfffffffe)
  struct.unpack("I", u)
(4294967294L,)

In SNMP, for example, a Counter32 is basically an unsigned int, defined
as "IMPLICIT INTEGER (0..4294967295)". One cannot efficiently translate
and use that type in native Python. Currently, I have defined an
"unsigned" type as a subclass of long, but I don't think that would be
speed or storage efficient.

On the other hand, adding my own type won't help with the ioctl()
problem, since it won't know about it.




-- 

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keith Dart <kdart at kdart.com>
    public key: ID: F3D288E4
    =====================================================================
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4