Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'exec': 0.07; 'python': 0.08; '#define': 0.09; 'am,': 0.12; 'def': 0.14; 'do!': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ha!': 0.16; 'subject:() ': 0.16; '\xa0def': 0.16; '\xa0for': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'received:209.85.210.174': 0.18; 'received:mail-iy0-f174.google.com': 0.18; "doesn't": 0.23; 'gcc': 0.23; '\xa0if': 0.23; 'header:In-Reply-To:1': 0.23; 'code': 0.25; 'code.': 0.26; 'message-id:@mail.gmail.com': 0.29; 'angry': 0.30; 'subject:?': 0.31; 'nov': 0.31; "can't": 0.32; 'to:addr:python- list': 0.32; 'unless': 0.35; 'clearly': 0.36; 'using': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; "there's": 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'more': 0.60; 'your': 0.61; '2011': 0.62; 'life': 0.63; 'covers': 0.64; 'policy': 0.64; 'home.': 0.75; 'face,': 0.84; 'ps.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=cIDyu1BcUhCjfApVA4n+eesFwwj7Cq/y/O+cAdCMq+c=; b=Q8dwmNEiApO1L5rc7m5Axhx9SYXHAuAqCEi4MLTEPTLgM3VTTjap/WLL4Gcem071HZ rv9XBz9vj5QoowDTFkLz5AItUp6JE2sZsWqDlDi4hLp1Ejz8T7JWLaY/VeArboSsI6aB xRiH3Fp2Hl3TSnW8LePM9yCIHJjgYFEB87Uo8= MIME-Version: 1.0 In-Reply-To: References: <436fb6a3-1075-45a6-8f93-5612d050b11a@q35g2000prh.googlegroups.com> Date: Wed, 9 Nov 2011 12:19:42 +1100 Subject: Re: all() is slow? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320801585 news.xs4all.nl 6912 [2001:888:2000:d::a6]:58271 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15490 On Wed, Nov 9, 2011 at 11:44 AM, Devin Jeanpierre wrote: > Clearly what we need is a modern hygienic macro system to avoid this exec= mess! > > defmacro defall(name, cond): > =A0 =A0def name(lst): > =A0 =A0 =A0 =A0for a in lst: > =A0 =A0 =A0 =A0 =A0 =A0if not cond: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return False > =A0 =A0 =A0 =A0return True #define defall(name,cond) def name(lst): \ for a in lst: \ if not cond: return False \ return True gcc -E myprog.pyi -o myprog.py There's no code you can't make more opaque using the C preprocessor. Python doesn't have inline functions? Ha! In your FACE, evil Python development cabal! You can't tell ME what I can't do! ChrisA PS. Don't try this at home. We have years of experience with bad code. Don't write code like this unless you have a life insurance policy that covers angry mobs.