types Module (stx.types)

scitex-types: Scientific type definitions and validation.

scitex.types.is_array_like(obj)[source]

Check if object is array-like.

Return type:

bool

Returns:

bool: True if object is array-like, False otherwise.

scitex.types.is_list_of_type(obj, types)[source]

Check if obj is a list where all elements are of one of the specified types.

This is an alias for is_listed_X with a more conventional name.

Parameters:
  • obj – Object to check

  • types – Type or list of types to check against

Returns:

True if obj is a list and all elements are of one of the specified types

Return type:

bool

scitex.types.is_listed_X(obj, types)[source]

Check if obj is a list where all elements are of one of the specified types.

Parameters:
  • obj – Object to check

  • types – Type or list of types to check against

Example

obj = [3, 2, 1, 5] is_listed_X(obj, int) # Returns True is_listed_X(obj, (int, float)) # Returns True is_listed_X(obj, str) # Returns False

Returns:

True if obj is a list and all elements are of one of the specified types

Return type:

bool