Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'compact': 0.09; 'subject:design': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bonus,': 0.16; 'burak': 0.16; 'elt': 0.16; 'iterable,': 0.16; 'subject:Language': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'looks': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'assert': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'sure': 0.39; 'how': 0.40; 'first': 0.61; 'enjoy': 0.71; 'mistakes,': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=6irRwbXjxzqYx+MrOrefNgW2/FG1HahjK9Fi162lfOs=; b=Ay2iC7AZ44u//NBg70MLvKu337wpJzxkqPROp/hCk4hZE0HoKLF1nr74cwN1yNApDA lTlxPmLKqPuc7HgRPR5LroLLCK0kS446FvsSQsD3QXdU6TXjhwO7Gw64llP8Bz6K3P7L 4Y3J1qfLZrzawihBVTHtA9YSnhEGp+i0LAEYskOGOltKpu8hgrUHzElrCYLEO+DFpr+r R/9+6utYFojfE4P1vfFdBlSeiivzBmIC6KJcUqgCntqlGKortiMwIzzay368wY4iVER0 33V+UuBBt1cFyNg4iOBGF+gWFtPYT7wpmIr7TOLtcmEiDN8kPMRbRx+gm6BV4zrrYr1e wEKg== X-Received: by 10.152.5.162 with SMTP id t2mr4308755lat.1.1378959504750; Wed, 11 Sep 2013 21:18:24 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: <5230480E.2030406@arskom.com.tr> References: <522eb795$0$29999$c3e8da3$5496439d@news.astraweb.com> <5230480E.2030406@arskom.com.tr> From: Joshua Landau Date: Thu, 12 Sep 2013 05:17:44 +0100 X-Google-Sender-Auth: W9oLVzrJQvhn4QNbdQ4C3hJpyHg Subject: Re: Language design To: Burak Arslan Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378959513 news.xs4all.nl 15936 [2001:888:2000:d::a6]:38783 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54031 On 11 September 2013 11:38, Burak Arslan wrote: > On 09/10/13 09:09, Steven D'Aprano wrote: >> What design mistakes, traps or gotchas do you think Python has? > > My favourite gotcha is this: > > elt, = elts > > It's a nice and compact way to do both: > > assert len(elts) == 0 > elt = elts[0] > > but it sure looks strange at first sight. As a bonus, it works on any > iterable, not just ones that support __getitem__. I very much enjoy the "[elt] = elts" spelling, although I don't get how this is a "gotcha". It's just a semi-obscure usage of unpacking.