Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'inspired': 0.05; 'subject:code': 0.07; 'weeks.': 0.07; 'raises': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'abusing': 0.16; 'nick': 0.16; 'stupid,': 0.16; 'subject:simple': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'library': 0.18; 'bit': 0.19; "python's": 0.19; 'bonus': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'on,': 0.29; 'points': 0.29; 'raise': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; 'could': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'done': 0.36; "i'll": 0.36; 'so,': 0.37; 'easily': 0.37; 'skip:[ 10': 0.38; 'pm,': 0.38; 'how': 0.40; 'simple,': 0.60; "you'll": 0.62; 're:': 0.63; 'more': 0.64; '30,': 0.65; 'to:addr:gmail.com': 0.65; 'insane': 0.93; '2013': 0.98 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 :cc:content-type; bh=HvNYRv9fKb/zByCWY1qdlOy9ADKWQREo4Kr8MUF9YTM=; b=Efd/cIYI8uXpJoU3dKRz/rVxOlbwQY7QwzfPzcniqsGgnWh2vrIe8otJjjidKhVBLU xgMW6W9/xF6uhEeNSz3wQ4rEp6CztC3pGKs6DpJoJbTlDCYL8z4lizwIEeAZQys36TvW EAhXTGLJVLb7XL0zKErzSLrop1BiyDXaTek3h1z62fEkkJdVdABPji/UlkmUioFxubKI ymu+TOroBn5uosSJ7ftgzCS+pzPs7Uhny42ZzXICwp2W2q9WY2RSKRtkOiNoQ2ApjyCu KfNN1XJwoqkPBebIz6nPBOuEFXXKC4ngGP6+Db95/x/YFfYZymkTn7Ua4ZTYTBRQavDO kHvQ== X-Received: by 10.112.5.199 with SMTP id u7mr9450325lbu.67.1372574840478; Sat, 29 Jun 2013 23:47:20 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Joshua Landau Date: Sun, 30 Jun 2013 07:46:40 +0100 Subject: Re: Stupid ways to spell simple code To: Chris Angelico 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372574848 news.xs4all.nl 15949 [2001:888:2000:d::a6]:45031 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49479 On 30 June 2013 07:06, Chris Angelico wrote: > There's a bit of a discussion on python-ideas that includes a function > that raises StopIteration. It inspired me to do something stupid, just > to see how easily I could do it... > > On Sun, Jun 30, 2013 at 3:45 PM, Nick Coghlan wrote: > Re: [Python-ideas] "Iteration stopping" syntax >>>>> def stop(): >> ... raise StopIteration > > Here's a much more insane way to spell that: > > stop = (lambda: 0 and (yield 1))().__next__ > > So, here's a challenge: Come up with something really simple, and > write an insanely complicated - yet perfectly valid - way to achieve > the same thing. Bonus points for horribly abusing Python's clean > syntax in the process. > > Go on, do your worst! You'll have to excuse me -- I'm writing a library to do just that. I'll be done in a few weeks.