Translating Matlab code to Python
<p>I need to translate chunks of matlab code into Python. My code seems to be 'unreachable' though. Any idea why this is happening? 
Also: am I doing it right? I'm a real newbie.</p>

<p>Matlab code:</p>

<pre><code>function Dir = getScriptDir()
    fullPath = mfilename('fullpath');
    [Dir, ~,~] = fileparts(fullPath);
end

function [list,listSize] = getFileList(Dir)
    DirResult = dir( Dir );
    list = DirResult(~[DirResult.isdir]); % select files
    listSize = size(list);
end
</code></pre>

<p>My Python code: </p>

<pre><code>def Dir = getScriptDir():
    return os.path.dirname(os.path.realpath(__file__)
def getFileList(Dir):
    list = os.listdir(Dir)
    listSize = len(list)
    getFileList() = [list, listSize]
</code></pre>

<p>Remember that you need to return variables from a python-function to get their results. </p>

<p>More on how to define your own functions in python: <a href="https://docs.python.org/3/tutorial/controlflow.html#defining-functions" rel="nofollow">https://docs.python.org/3/tutorial/controlflow.html#defining-functions</a></p>

python matlab function translation