Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'subject:Python': 0.05; 'encouraging': 0.07; 'mysql,': 0.07; 'sql.': 0.07; '(although': 0.09; 'postgresql,': 0.09; 'received :mail-lpp01m010-f46.google.com': 0.09; 'rows': 0.09; 'sep': 0.09; "wouldn't": 0.11; 'hire': 0.15; 'expect,': 0.16; 'iterating': 0.16; 'length,': 0.16; 'offset,': 0.16; 'parameter,': 0.16; 'plus,': 0.16; 'sad': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'code,': 0.18; 'changes': 0.20; 'bit': 0.21; '(all': 0.22; 'subject:Questions': 0.22; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'trouble': 0.28; 'run': 0.28; 'far.': 0.29; 'questions.': 0.29; 'unlikely': 0.29; 'probably': 0.29; 'query': 0.30; 'received:209.85.215.46': 0.30; 'returned': 0.30; 'system,': 0.32; 'anybody': 0.32; "he's": 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'same.': 0.35; 'table': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'problems': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; "you'll": 0.62; 'gave': 0.65; 'limit': 0.65; 'frequently': 0.65; 'lack': 0.71; 'guaranteed': 0.76; 'subject:Interview': 0.84; 'to:name:python': 0.84; 'inefficient': 0.91 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=5V8CsxZeMv82/t5Ea5Gg3aakEX4LWNR2qsCAA6Q/jng=; b=tYzu5K7+oOkVY4OS4/p/QxIIn01q8K6zEyc9YNgnczmRnkbF8n1eWOmpMZn9U1BqEl JUdV/9OAqUSoLmg9LommVF1hwtRwdhfIYG/uJCYgikbUeEo/JxZZj0OjulZRWSMOz7vQ 6FX3CpUc951pk78y0CGaTF+tdNavWA/D595lTAT40zqeA6VO18vrEOAWeDc7RVWWUWjo qe/fqGjXZkIbPAVZ6qczwelw8wmE93k0JdHA7NPu+wepW1rEWMarpGhB7t66yh4OUM+V 1aNvseg+Vh6v1OE+kh3z5EwDt8FCp0KMazcP9xTxzNJ5v6GvEnEHNLC5vt+RvR4nSqDc UcZA== MIME-Version: 1.0 In-Reply-To: References: <1193768041.349129.26350@v3g2000hsg.googlegroups.com> From: Ian Kelly Date: Wed, 5 Sep 2012 09:22:58 -0600 Subject: Re: Python Interview Questions To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346858610 news.xs4all.nl 6853 [2001:888:2000:d::a6]:37041 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28507 On Wed, Sep 5, 2012 at 8:34 AM, Chris Angelico wrote: > I wouldn't go that far. The 'name' parameter, I would expect, would be > a constant. The 'item' parameter, though, is probably not a constant, and it's interpolated just the same. > However, this strikes me as encouraging some really > inefficient code, like iterating over all the rows in a table with N+1 > queries (one to get the length, then a separate query for each row). > Plus, use of limit without order by is not guaranteed (although since > this is specific to MySQL, it's unlikely you'll run into trouble - but > PostgreSQL, with its MVCC storage system, frequently reorders rows in > a table). The lack of an ORDER BY is the least of the problems with that SQL. He's also using LIMIT without OFFSET, so the only thing that the 'item' argument changes is how many rows are returned (all but one of which are ignored), not which one is actually fetched. It's a bit sad that these are touted as answers to interview questions. I wouldn't hire anybody who gave answers like these.