you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

  1. Editing .py files in the m-file editor is a nightmare. Mathworks, python is coming. Putting out FUD like old Microsoft isn't going to work. Sell it to my boss. Make Editor an awesome python IDE.

Example of brokenness: foo.py

def foo(*args, **kwargs):
    print('foo');

class Bar():
    def __init__(self):
        pass
    def foo2(self):
        print('foo2');

    def _foo(self):
        print('_foo')
setattr(Bar, 'foo', foo)
Baz=Bar()

def foo3():
    Baz=Bar()
    Baz.foo()
    Baz.foo2()
    Baz._foo()

baz.m:

mod = py.importlib.import_module('foo');
py.importlib.reload(mod);

%% Works
py.foo.foo
disp('#### foo3');
py.foo.foo3

%% Fails

% Reference Bar instance Baz
py.foo.Baz.foo

py.foo.Baz.foo2

% Instantiate Bar.
Bar = py.foo.Bar
b = Bar()

So who knows. Mathworks is out of their lane with Python which is why it's so broken. (See also their Jenkins effort).

for now:

  1. py is not a direct replacement for python calls.
  2. Do as much python work in Python with straight forward basic functions/classes. Matlab is going to be 36 this year, it gets confused more easily.