Python import causing syntax error
<p>I'm an old-fashioned Pascal programmer, new to OOP and Pyhton, so please bear with me...I've got a book on Python and I've searched here first (although lots of similar threads - not checked every one)...</p>

<p>I'm trying to write a program to include existing modules written by others in my company. According to my Python book, I should be able to import whole modules or just specific classes. The book says that when 'import' is used, it actually runs the specified code (not like the INHERIT I'm used to in Pascal).</p>

<p>I have this structure in the module, mod.py, I want to use:</p>

<pre><code>from x.y.z import stuff

class c1(superclass):
    def func1(self):
        ....
    def func2(self, db):
        ....
        with self.db as handler:
            ....
</code></pre>

<p>and I've got a basic script, test.py, that does just this:</p>

<pre><code>from mod import c1

print "Hello"
</code></pre>

<p>when I execute 'python test.py', I get the error message:</p>

<pre><code>'with self.db as handler' - invalid syntax
</code></pre>

<p>I think I'm missing something fundamental here, so any help much appreciated.</p>
