Saturday, April 3, 2010

Helper functions for Python

Since the new API uses C data structures, the interface is a bit unfriendly for Python. So, I added the following functions for ease of programming:

toItems: converts Python list of Items to ArrayOfItems
fromItems: converts ArrayOfItems to Python list of Items

toStrings: converts Python list of strings to ArrayOfStrings
fromStrings: converts ArrayOfStrings to Python list of strings

toMatrix: converts Python list of list of reals to Matrix (two optional arguments for row and column names)
fromMatrix: converts Matrix to a list of row names, column names, and 2D list of reals

No comments: