Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'cursor': 0.09; 'trailing': 0.09; 'def': 0.12; '(),': 0.16; 'commas,': 0.16; 'one-element': 0.16; 'tuple': 0.16; 'tuple;': 0.16; 'exception': 0.16; 'topics': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'meant': 0.20; 'mon,': 0.24; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'author,': 0.31; 'tuples': 0.31; 'created': 0.35; 'received:google.com': 0.35; 'christian': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'new': 0.61; '20,': 0.68; 'subject:there': 0.68; 'id,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=cGnlDvlDjv3ywjoPBmVRMLtPS7H08UhdFVf26Tm3ECI=; b=anN0U4By9bamOPZYioNxJrIBTWP2W3d9+r6Hqp4mkZkNLrNBhqSt88w/K6iSjdzhuP GBddiVZzGUDq/HeDw7jvjn5cv0aEyXgUnS59yJtr5J8OgI057ZNcA+kqmoW7yyEFd/B4 0cEHmVUhAaoILE1N/ackdBcpZ6oIIKidf2InD8Lz6A7jrwxoTaaJTiOLuV79NovVma6Y Rood9729zcDJ6FbhA7qXBgGZFLdfQmWA37UVeWtcDQ75PZjSFekP7Bw3B48iqYLPEJkX ljeZkldPmYJTBDohciqjdhQqG981kaSHLiGNo0xfActhlj6Kgp4zwURAFdJ83qnMZDRB esyA== X-Received: by 10.66.191.135 with SMTP id gy7mr29642573pac.95.1413834087276; Mon, 20 Oct 2014 12:41:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <9a0c67be-de3a-4770-bf06-e158783bfff0@googlegroups.com> <54424691$0$12978$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Mon, 20 Oct 2014 13:40:47 -0600 Subject: Re: Is there an easy way to control indents in Python To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413834091 news.xs4all.nl 2978 [2001:888:2000:d::a6]:44623 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79326 On Mon, Oct 20, 2014 at 1:04 PM, Juan Christian wrote: > Ok, new code using ?: I suspect you meant to post this to some other thread. > def get_db(_id): > cursor = db.execute("SELECT ID, URL, AUTHOR, MESSAGE FROM TOPICS WHERE ID = > ?", (_id)) > return cursor.fetchone() (_id) is not a tuple; it's just a parenthesized variable name. To create a one-element tuple you need a trailing comma: (_id,) Remember that with the exception of the empty tuple (), tuples are created by commas, not parentheses.