[plum.int] Module Reference

Interpret bytes as an integer.

class plum.int.Int([x, ]base=10)

Interpret bytes as an integer.

Parameters:
  • x (number or str) – value
  • base (int) – base of x when x is str
class plum.int.IntType(name, bases, namespace, nbytes=None, signed=None, byteorder=None, dref=None)

Int type metaclass.

Create custom Int subclass.

Parameters:
  • nbytes (int) – number of bytes
  • signed (bool) – signed integer
  • byteorder (str) – 'big' or 'little'
  • dref (PlumType) – pointer dereference type

For example:

>>> from plum.int import Int
>>> class SInt24(Int, nbytes=3, signed=True, byteorder='big'):
...     pass
...
>>>