Inspirel banner

Programming Distributed Systems with YAMI4

3.8.5 Python

The concept of finding the existing entry and checking dynamically its type is solved differently in the Python library and is more aligned with the natural capabilities of Python to inspect its data structures.

The syntax for searching items in the Parameters object is based on the built-in ``in'' operator:

if "first_name" in params:
    # ...

Checking the type of the existing entry can be performed with the built-in ``type'' operator:

if type(params["first_name"]) == str:
    # ...

It should be noted that even though there is some liberty in how data is passed to YAMI4 (dictionary can be used instead of Parameters and any iterable can be used instead of lists), the YAMI4 library always reconstructs the data in a deterministic way - arrays are accessible as lists and nested objects are always of type Parameters.