Skip to content

Size

Defines size utilities.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

References

NONE

SizeUnit

Bases: IntEnum

Defines the valid size units.

get_size(obj, unit=SizeUnit.BYTES)

Get the pickle-serialized size of an object in the given unit.

Note

This measures the size of the object when serialized using pickle, NOT its in-memory footprint.

Parameters:

Name Type Description Default
obj Any

The object to get the size of.

required
unit SizeUnit

The unit to get the size in. Defaults to SizeUnit.BYTES.

BYTES

Returns:

Name Type Description
float float

The size of the object in the given mode.