I find this code to be very readable.<br><br>I, personally, would not use quite so much vertical white space, like whole lines with only a &quot;(&quot;, but that is a matter of aesthetics only. My senses were probably permanently marred by learning to program using punched cards and 14 7/8 inch printer paper. Vertical space killed trees back then. Also, for production code, I would specify the exceptions I expect to catch in the try: except, and then re-raise the same exception. Always raising IOERROR may lead one astray from finding the actual cause of the error.  These are small things.<br>

<br>Your program is not only correct, it&#39;s also beautiful.<br>--<br>Vernon<br><br><div class="gmail_quote">On Sun, Nov 21, 2010 at 1:02 PM, John Q. Public <span dir="ltr">&lt;<a href="mailto:sqlite3.user@gmail.com">sqlite3.user@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
Is this how my createdb() method should look like?<br>
How would you write this method so it is both readable and correct?<br>
Thank you for your time and patience.<br>
<br>
def createdb(self):<br>
    try:<br>
        con = sqlite3.connect(db)<br>
        cur = con.cursor()<br>
<br>
        cur.execute(&#39;&#39;&#39;<br>
            CREATE TABLE t1<br>
            (<br>
                kid INTEGER PRIMARY KEY,<br>
                c1 TEXT,<br>
                c2 TEXT<br>
            )<br>
        &#39;&#39;&#39;)<br>
<br>
        cur.execute(&#39;&#39;&#39;<br>
            CREATE TABLE t2<br>
            (<br>
                kid INTEGER PRIMARY KEY,<br>
                c1 TEXT,<br>
                c2 TEXT<br>
            )<br>
        &#39;&#39;&#39;)<br>
<br>
        cur.execute(&#39;&#39;&#39;<br>
            CREATE TABLE t3<br>
            (<br>
                kid INTEGER PRIMARY KEY,<br>
                c1 TEXT,<br>
                c2 TEXT<br>
            )<br>
        &#39;&#39;&#39;)<br>
<br>
        con.commit()<br>
    except:<br>
        a = &quot;ERROR: createdb did not commit. \n&quot;<br>
        b = &quot;tried this sql:   \n&quot;<br>
        raise IOError, &quot;%s%s%s&quot; % ( a, b, sql )<br>
    finally:<br>
        cur.close()<br>
        con.close()<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://old.nabble.com/Python-db-programming-conventions-tp29977345p30273508.html" target="_blank">http://old.nabble.com/Python-db-programming-conventions-tp29977345p30273508.html</a><br>


</font><div class="im">Sent from the Python - db-sig mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">DB-SIG maillist  -  <a href="mailto:DB-SIG@python.org">DB-SIG@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/db-sig" target="_blank">http://mail.python.org/mailman/listinfo/db-sig</a><br>
</div></div></blockquote></div><br>