I have a question about variable size in python, I\'m using the the Ctypes because i want a 1 byte number, but when I tried to check it\'s size in python (via sys.gets
The ctypes module is used for creating and manipulating C data types in Python. That is why ctypes.sizeof(ctypes.c_byte(1)) returns 1.
>>> import sys
>>> help(sys.getsizeof) Help on built-in function getsizeof in module sys:
getsizeof(...)
getsizeof(object, default) -> int
Return the size of object in bytes.
while
>>> import ctypes
>>> help(ctypes.sizeof)
Help on built-in function sizeof in module _ctypes:
sizeof(...)
sizeof(C type) -> integer
sizeof(C instance) -> integer
Return the size in bytes of a C instance
>>>