Path: csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'argument': 0.04; 'except:': 0.07; 'executable': 0.07; 'function,': 0.07; 'try:': 0.07; 'python': 0.09; 'def': 0.10; 'result.': 0.15; '"try"': 0.16; 'eckhardt': 0.16; 'executable.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instance:': 0.16; 'it".': 0.16; 'iterator': 0.16; 'run-time.': 0.16; 'subject:import': 0.16; 'syntactic': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'yield': 0.17; 'received:209.85.214.174': 0.21; 'closely': 0.22; 'statement': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'possibly': 0.27; 'message-id:@mail.gmail.com': 0.27; 'colon': 0.29; 'idea,': 0.29; 'occurred': 0.29; "i'm": 0.29; 'related': 0.30; 'call.': 0.30; 'function': 0.30; 'sense': 0.31; 'code': 0.31; 'could': 0.32; 'print': 0.32; 'says': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'said,': 0.35; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'except': 0.36; 'but': 0.36; 'display': 0.36; 'one,': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'end': 0.40; 'real': 0.61; 'map': 0.61; 'is.': 0.62; 'more': 0.63; 'making': 0.64; 'jul': 0.65; '"hey,': 0.84; 'construct': 0.84; 'everything.': 0.84; 'wrong!': 0.84; 'yielded': 0.84; 'imagine': 0.96 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=VulE4T2LMIcr+/RjdKVEu8DmN2e0Xy1c3j2QfzwuP5U=; b=xTmszibAPfbPP839Ybo9fqTIfx8+0z/D9hjypy28jJ5/iVuGK6ImyQjU5vHmkkemZ5 U1ssnEr5WfGoHa9szEK5n7zVyZ3XoToCXiLsAs+ach8SXJ8UvHyBR2TWJsSkounY+se5 ttlAN9eju/5gSP2P4qraLE3WvrrJ48c39BTYUudX7H/XgRusNoaNEmYKf5jZlRmAJ3Et YGrH6wNvruM3b/gzVqvRlJyMAObuo+3HdMAoudfkYNEOEtD6pNkB/bWIJKeZvOIb7kWO JaOUH196F83pTmr6gg7pRDUJg2F0R7MEfhRIBEUiyA7zBxHnDrLD3sGSm+Dq0VeZI9cn lmHg== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 26 Jul 2012 02:05:39 +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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343232342 news.xs4all.nl 6965 [2001:888:2000:d::a6]:59653 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26045 On Wed, Jul 25, 2012 at 6:40 PM, Ulrich Eckhardt wrote: > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, and similarly to the print() function, there > could be a pass() function that does and returns nothing. > > Example: > def pass(): > return > > try: > do_something() > except: > pass() Except that "pass" is a syntactic construct that basically says "hey, I have an indented block here, but there's no code in it". It's not executable any more than the syntactic token "INDENT" is. It's more closely related to the colon at the end of "try" than it is to the "do_something()" call. By comparison, Python 2's print statement is executable. It causes real action to happen at run-time. It makes sense to pass "print" as an argument to something; for instance: def some_generator(): yield blah map(print,some_generator()) Simple way of making the iterator display its yielded result. I cannot imagine any circumstance in which you'd want to map "pass" over everything. But then, as Teresa said, I'm only one, and possibly I'm wrong! ChrisA