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
{{ message }}
This repository was archived by the owner on Jun 27, 2021. It is now read-only.
Currently the Python-side matlab module only allows importing of matlab function handles in the primary namespace, not packages. This is semi-complicated by the fact that matlab maintains separate namespaces for functions and packages. An easy example is in this very project - the +py package and the py.m function. If you were to import matlab.py, what would you expect to get? If you got the function, then what would happen if you tried to import matlab.py.types? The solution may be related to the current solution - subclassing module. If we can make a module callable, then names gotten via the matlab module could potentially be both modules and function handles at the same time. Fortunately matlab packages are not first-class objects, so there is no ambiguity about which interpretation should be used should you try to pass one into a MATLAB function.
It may or may not be worth the effort to check what a name refers to when we create the object, but since MATLAB will gladly create function handles to names that don't exist (for reasonable reasons, likely related to class member functions), it may be best to go that route - MATLAB determines when a name is valid in a context exactly when you try to use it that way.
I'll probably fix this in jymex first and then bring it over. I expect that it should translate fairly directly.
Currently the Python-side
matlabmodule only allows importing of matlab function handles in the primary namespace, not packages. This is semi-complicated by the fact that matlab maintains separate namespaces for functions and packages. An easy example is in this very project - the+pypackage and thepy.mfunction. If you were toimport matlab.py, what would you expect to get? If you got the function, then what would happen if you tried toimport matlab.py.types? The solution may be related to the current solution - subclassingmodule. If we can make a module callable, then names gotten via thematlabmodule could potentially be both modules and function handles at the same time. Fortunately matlab packages are not first-class objects, so there is no ambiguity about which interpretation should be used should you try to pass one into a MATLAB function.It may or may not be worth the effort to check what a name refers to when we create the object, but since MATLAB will gladly create function handles to names that don't exist (for reasonable reasons, likely related to class member functions), it may be best to go that route - MATLAB determines when a name is valid in a context exactly when you try to use it that way.
I'll probably fix this in jymex first and then bring it over. I expect that it should translate fairly directly.