15.5   HALCON Tuples Are Represented With Native Python Types

Both when passing values into operators as input parameters, and when receiving values as return values from operators, what is represented with HALCON Tuples in HDevelop is a native Python value in HALCON/Python.

Don't confuse HALCON Tuples with Python tuples, they are unconnected concepts.

For example, the return value for get_image_size_s is truly of type int and not something that represents the HALCON version of integers.

img = ha.read_image('pcb')
width, height = ha.get_image_size_s(img)

assert width == 1109
assert type(width) == int

assert height == 871
assert type(height) == int

In HALCON/Python, HTuple maps to either one of the following types or to a possibly mixed list of them:

Python's float maps to HALCON's real type. While Python's int is of arbitrary precision, calling operators with int values outside what a signed integer of platform size can represent, e.g.: ptrdiff_t in C, will result in an exception.