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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.04; 'arguments': 0.07; 'function,': 0.07; 'python': 0.09; 'options.': 0.15; 'braces,': 0.16; 'did.': 0.16; 'executable.': 0.16; 'explicitly,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function?': 0.16; 'keyword.': 0.16; 'proceeds': 0.16; 'subject:import': 0.16; 'syntax,': 0.16; 'later': 0.16; 'wrote:': 0.17; 'exists': 0.17; 'thu,': 0.17; 'code,': 0.18; 'code.': 0.20; 'parameters': 0.20; 'received:209.85.214.174': 0.21; 'logical': 0.22; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'execution': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'represent': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'no,': 0.29; 'keyword': 0.30; 'function': 0.30; 'code': 0.31; 'point': 0.31; 'print': 0.32; 'goes': 0.33; 'function.': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'except': 0.36; 'but': 0.36; 'should': 0.36; 'why': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:209.85.214': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'back': 0.62; 'strange': 0.62; 'more': 0.63; 'making': 0.64; '26,': 0.65; 'jul': 0.65; 'believe': 0.69; 'alike.': 0.84 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=NEeH0oYAFQ71CDUgDNhnAIODhSxdOg5WYilrRCQROuA=; b=XbCCEz2kb8gvtWKi8nK4vCVYpHIK8YDqGH2Wd8VPe5Sd2oa/xY7CuTxg23HffRKHq4 n+zX2zM29Z0ilWU/pFtNioZ0bv2HaOa52WuQ77otjvst/kGQD8QNS4FowFN+mLFgi5eQ m0yaYjie9B01ZB8AfKkWiayWCSk3SCJlEFBQW7upYoFD5WHmYzr1Y+RSf8ZKnin0pXXW Tt6aeoblpBtXP7732HqMzTwo4B2FBqcEQQXfFpKrYdgDaiVJKuaVBcHm/8zgZBCxWXXo LXVm0tWMwAfK2g6H8zBq78w6qXQUbgfahp2J2V2OEK/Y+IDpo5Z3zQWSCprRJpCXM7lR 1C+A== MIME-Version: 1.0 In-Reply-To: References: <500fd986$0$29978$c3e8da3$5496439d@news.astraweb.com> <5010adb8$0$29978$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 26 Jul 2012 13:53:20 +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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343274803 news.xs4all.nl 6916 [2001:888:2000:d::a6]:58396 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26056 On Thu, Jul 26, 2012 at 1:30 PM, Ross Ridge wrote: > Steven D'Aprano wrote: >>I can't believe I actually have to point this out explicitly, but pass is >>not print. Apart from them both starting with the letter "P", they are >>nothing alike. There are good reasons for making print a function, and >>they don't apply to pass because pass doesn't do what print does. > > No, they're very much alike. That's why all your arguments for print > as function also apply just as well to pass a function. Your arguments > had very little to do what what print actually did. Except that print / print() is executable. Execution proceeds through your code, comes to a "print", and goes off to handle that, then comes back to your code. But "pass" doesn't have code attached to it. Why should it be a function? One of the reasons for print becoming a function was its strange collection of modifiers. How do you, with the print statement, send output to someplace other than stdout? How do you make it not put a newline? Far more logical to make those into keyword-only arguments to a function, and far easier to later add more such options. What parameters do you give to "pass"? The pass keyword exists because Python can't have an empty pair of braces, or an empty semicolon, to represent a "null statement". It needs a keyword. That keyword is syntax, not code. ChrisA