Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Why not allow empty code blocks? Date: Sun, 24 Jul 2016 21:27:13 +1000 Lines: 32 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <20160723082947.7cae8bd1@imp> <87fur0a44p.fsf@elektro.pacujo.net> <20160723095441.29562c54@imp> <57939373$0$1586$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de DXW153RKBy3ghWiMVLUrlQCPRg4j+xWXtpn6KSP9Ei2A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; '__future__': 0.09; 'braces': 0.09; 'directive.': 0.09; 'subject:Why': 0.09; 'subject:not': 0.11; 'def': 0.13; '2016': 0.16; '24,': 0.16; 'evaluated.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'terminate': 0.22; "python's": 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'followed': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:google.com': 0.35; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'support,': 0.37; 'end': 0.39; 'impact': 0.61; 'jul': 0.72; 'actually,': 0.84; 'chrisa': 0.84; 'to:none': 0.91 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:cc; bh=0cVCa7eGOyxAX37EuaDzEYiWZ6vUgDYOW2Qyc5wBXdU=; b=cLkx6VZq3/hwLjJ6ntFfFRj1WQ7jqKbDlCg8GugVgdriFw4HTLju/tI4kxRcCV01Xs LtwYzijtyom4LNqYGwegHDCXwFoj/5AL2aT8YwuGnHtNrAncQrnWFGZONPKtOIdxabiA FgBULYhvi5HVVAgrGQKmoBTB9uKIlMS3bcaxPevQDywF4i95ISCHfVsbiYb99ddIsVY4 uIJmGt6r8ceVxS1dhY4cVOmJbEWp9PPDoLQFynZP7ZVh2OAwAxE3qNhhsbq25ye6mpLD wdOi3pl3XWOhorSzDazX+haTwQsPfz+C4+muwiKnkP8VRLYPiYYoigprdqztYoRzB642 Tq8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=0cVCa7eGOyxAX37EuaDzEYiWZ6vUgDYOW2Qyc5wBXdU=; b=FRo3WYuDiWlIAXtaS/lOyEH4R25vA87M/VqLhyWc1WP0do1E63g+h669OQb+do1vRH +PYaLbI2pZmdbX1MIZr9rSOMBnhHhE30wgAmDOGHlu1jpBJrl35cpws60/I+k8WLMMpV JZTlGLaWeKeVFwmS4pkQzZmgVmhvNReT0MAtyGqQVWm+GmmNCxIZSSNXB06J1noK/Ue7 lB6AXB+ViK9/J54p6W1O8Q3mA8rvHosVZ4BqXL5noh232SeYRb12KqpCLRjLul2HDpbk HdBBUSx03HveCCIhL5+wQmvsrbRZnxRpBadmSErs3j6n/jA+X9TqLrOJF9C1ktpuaa1b qIiw== X-Gm-Message-State: AEkoousqfPyTBESFhByhu4Yl6/ZTlmJT5/bwACS6HuNJQIE+pO9Hxco9UvNZfnY6Q210FnNLJTwGeMfgX7ORZQ== X-Received: by 10.28.45.69 with SMTP id t66mr12368977wmt.41.1469359634397; Sun, 24 Jul 2016 04:27:14 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <20160723082947.7cae8bd1@imp> <87fur0a44p.fsf@elektro.pacujo.net> <20160723095441.29562c54@imp> <57939373$0$1586$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:111802 On Sun, Jul 24, 2016 at 8:45 PM, BartC wrote: > 'end' to terminate a block can be emulated of course: > > end=0 > > def fn(a): > if a<=1: > return 1 > else: > return fn(a-1) > end > end > > And in this example it wouldn't impact on performance as it is not > evaluated. Actually, they would be (you'll have a LOAD_GLOBAL followed by POP_TOP). Much better to use Python's inbuilt hash-braces support, available via a hash-future directive. #from __future__ import braces def fn(a): #{ if a <= 1: #{ return 1 #} else: #{ return fn(a-1) #} #} ChrisA