Python function definition
<pre><code>def CsMatrix(X not None):
</code></pre>

<p>I meet this piece of code. For <strong><em>X not None</em></strong>, I haven't met this kind of syntax? So I write my test code:</p>

<pre><code>def test(x not None):

    pass
</code></pre>

<p>However, I got SyntaxError: invalid syntax.
Can anyone explain this syntax?</p>

<pre><code>def CsMatrix(X not None):
    pass
</code></pre>

<p>Is it possible that you mis-read it? Definitely not valid...
If you have the link to thesite where you seen it, could you post it?</p>

<p>You also said "For x not None" implying it might be used in a for loop as well?  This would also be bad syntax.
You can (as suggested) set a default value for "x", in this case 'None'</p>

<pre><code>def test(x = None):
    if x is None:
        print "Nothing was passed to this function!"
    elif x not None:
        print "The function received: ", x
    else:
        print "There's no way this should ever print"
</code></pre>

python