Basic Python Types and OML Type Mapping
The table below compares the data types in OML and Python that can be used when creating a bridge between the two languages.
Python Basic Type | OML Type | Comments |
---|---|---|
Bool | Logical | |
Int | Number | |
Float | Number | |
Complex | Complex | |
String | String | In OML, only single quotes are supported. Support for UTF-8 strings. |
List | Cell (1, n) Limitation 1: Not supported if the list contains one of the following: Dict (with limitation), Tuple, or Set Limitation 2: cell of 1, n only exported to the Python list. |
A list in Python is an ordered group of items (or elements). It's a general structure, and list elements do not have to be of the same type; you can put numbers, letters, strings, and nested lists in the same list. |
Tuple | Not supported. | A tuple in Python is like a list except that it is immutable once created. |
Set | Not supported | A set is an unordered collection of objects, unlike sequence objects, such as lists and tuples, in which each element is indexed. |
dict | Struct Limitation 1: Only supported if keys in dict are string or char only. Limitation 2: Only one-dimensional struct is copied to the Python dict. |
The key of struct is char | string, but the key of dict can be any hashable, such as integers or floating points. |
None | Not supported |