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!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.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'function,': 0.07; 'python': 0.09; 'def': 0.10; 'language': 0.14; '"if"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operator.': 0.16; 'subject:import': 0.16; 'ternary': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'received:209.85.214.174': 0.21; 'ones.': 0.22; 'statement': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'functions.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'fri,': 0.30; 'function': 0.30; 'could': 0.32; 'turns': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'received:google.com': 0.34; 'continue': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'next': 0.35; 'but': 0.36; 'functional': 0.36; 'test': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'easily': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'back': 0.62; 'between': 0.63; 'mentioned': 0.63; 'more': 0.63; 'jul': 0.65; 'suited': 0.71; "it'd": 0.84; 'dennis': 0.91; 'fun!': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=uUXli4o044896ksAAEKjI6/ryTAh+lArHzm4sC1DdQE=; b=vc96LzC5UClInpNLT1Auv2bUa1mCQlDbjRlXgRDX3SE1TKbJDn/t0kjmkqVGR6k/Xx Wbb9jrJlujtIeVJi+IMeY+jgYcnTEB87zohq6LGQpbiNVBXCidLrf9S9674pZevCvXMg wqx3r92rfrdh8Wk29LuLLEYQjzRFFyARZo1ojVifGMAdFxNMmuOuIbnuvO5BOql9z3Yo 1DEoMtZlKXzHEArUgKssWNZHzK8kXipMlkCSAJzLrlct6OQOxWWXMxZ6/SM6SJD8TO+A yOGy2+MXDNnGoU5aQlKQTIrHKqi42UQB9b1WX0wY1/sb9sbZnSwDKWEtVupkLweMNVDG LjYw== MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 27 Jul 2012 04:14:17 +1000 Subject: Re: from future import pass_function From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343326460 news.xs4all.nl 6931 [2001:888:2000:d::a6]:34771 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26107 On Fri, Jul 27, 2012 at 4:01 AM, Dennis Lee Bieber wrote: > On Thu, 26 Jul 2012 19:42:11 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > >> Well, if/while/for could be functions. So could with, probably. Now, >> def would be a little tricky... >> > And how would a function "if" perform It'd be much more similar to the ternary operator. Currently there's no way to pass an unevaluated expression to a Python function, but the concept isn't impossible. It's just more suited to functional languages (someone mentioned Haskell) than to imperative ones. > Now, how does the language differentiate between a loop and an if? > > if(conditional): > do something and continue with next statement > > turns into > True: > do something and continue with next statement > > while > > while(conditional): > do something and go back to the test > > turns into > True: > do something and go back to the test Oh THAT's easily solved. A while loop is an if with a goto! Okay, was that sufficiently incendiary? Have fun! :) ChrisA