You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.py files in lifelib models are pseudo- Python code. They are wirtten in Python syntax to take advantage of Sphinx, Python's documentation generator. The mx.read_model doesn't import them as modules, but read them as texts and parse the texts using the ast standard library.
Then it creates cells by passing extracted function definiton strings to new_cells.
defcells decorator is a shortcut for new_cells. It actually creates a new function from the text string of the decorated function's definition.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
(Originally posted at https://modelx.io/blog/2022/10/29/why-you-should-use-modelx/)
.py files in lifelib models are pseudo- Python code. They are wirtten in Python syntax to take advantage of Sphinx, Python's documentation generator. The
mx.read_model
doesn't import them as modules, but read them as texts and parse the texts using the ast standard library.Then it creates cells by passing extracted function definiton strings to
new_cells
.defcells
decorator is a shortcut fornew_cells
. It actually creates a new function from the text string of the decorated function's definition.Beta Was this translation helpful? Give feedback.
All reactions