Code References
Read this page to know how to use primitive-type library.
At present, all methods, type aliases could be imported from path primitive_type immediately.
Type Aliases
Type aliases for primitive types.
Note
Real API path: primitive_type.types
Type Checker
Utils for checking objects.
Note
Real API path: primitive_type.checker
Type Converter
A quick and simple converter to convert the type of an object.
Note
Real API path: primitive_type.converter
- get_primitive_object(val: Primitive, obj_type: type[Primitive] = None) Primitive[source]
Get a primitive object from a given value.
- Parameters:
val – The given value wants to be converted.
obj_type – The target type of object that finally converted out. Default to
Noneas disabled.
- Returns:
Note
Methods get_str_object, get_int_object, get_float_object and get_bool_object are simplified method for get_primitive_object, they return get_primitive_object(val, <type>) and confirm the return type is specified type.
- get_str_object(val: Primitive) str[source]
Get a string object from a given value.
- Parameters:
val – The given value wants to be converted.
- Returns:
A string object.
- get_int_object(val: Primitive) int[source]
Get an integer object from a given value.
- Parameters:
val – The given value wants to be converted.
- Returns:
An integer object.