Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Why not allow empty code blocks? Date: Sat, 30 Jul 2016 23:41:44 -0400 Lines: 23 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <579B1ABB.1070500@rece.vub.ac.be> <579c2095$0$22142$c3e8da3$5496439d@news.astraweb.com> <579ca644$0$1589$c3e8da3$5496439d@news.astraweb.com> <579ccc68$0$1583$c3e8da3$5496439d@news.astraweb.com> <579d5e2d$0$1612$c3e8da3$5496439d@news.astraweb.com> <1469936504.1070453.681532785.0741A8AD@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de XgLvq5rVy5OBPVYrANoqswF8Plj5oFpBld7FLYII4/9Q== 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; 'python,': 0.02; 'anyway.': 0.04; 'emulate': 0.07; 'implements': 0.07; 'subject:code': 0.07; '"if': 0.09; 'finite': 0.09; 'received:internal': 0.09; 'subject:Why': 0.09; 'assume': 0.11; 'subject:not': 0.11; 'applies': 0.15; 'argument': 0.15; '"while': 0.16; 'bytecode': 0.16; 'conditional': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'peephole': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'exists': 0.18; 'programming': 0.22; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; '(which': 0.26; 'figure': 0.27; 'loop,': 0.29; 'code': 0.30; "d'aprano": 0.33; 'jump': 0.33; 'steven': 0.33; 'there': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'being': 0.37; 'received:66': 0.38; 'means': 0.39; 'enough': 0.39; 'takes': 0.39; 'to:addr:python.org': 0.40; 'care': 0.60; 'skip:u 10': 0.61; 'header:Message-Id:1': 0.61; 'personally': 0.61; '30,': 0.63; 'needing': 0.63; 'forward': 0.66; 'fact,': 0.67; 'jul': 0.72; 'construct': 0.84; 'have.': 0.93; 'taught': 0.97 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=xhd/10EU8266pNqaHCDo5k771wI=; b=DzZF1v 4vGrusHcTzmElPAzfm5WIYa2+GZMLSZrUAZhkZ/JKZmnpoUeSwXPqmm59SfizxZH 2PcAMZ0EhS+DAeuZrEmWe01TbINApLU2fRasYaB5/FhG/gtbkl0za45CxvBuEQn0 hjTEZOb0jgyEBg6JSw4lAWZ4v54NBDy6eBN8o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=xhd/10EU8266pNq aHCDo5k771wI=; b=qN92t3iHpumPc/OrhyRPWEP+yRdGk1xQvbk6aEppdj2Le1I CTIbUTy/P6U39yrNlPvyfUbF7Zkw6RTZ6OIoz2ZlurZALu16tDO+VAZ0z2GrQjLC 7xYvxJA5h2nG5Z5NqdzRPyCY6jXSqrkQtJPCxY1kjYKkjv9uRPR+S8mzkBa0= X-Sasl-Enc: Kkfy6xIX3/+ZlmXyeCHomehvmkcloLwO8uRdg5OjVPBn 1469936504 X-Mailer: MessagingEngine.com Webmail Interface - ajax-501c3c37 In-Reply-To: <579d5e2d$0$1612$c3e8da3$5496439d@news.astraweb.com> 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: <1469936504.1070453.681532785.0741A8AD@webmail.messagingengine.com> X-Mailman-Original-References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <579B1ABB.1070500@rece.vub.ac.be> <579c2095$0$22142$c3e8da3$5496439d@news.astraweb.com> <579ca644$0$1589$c3e8da3$5496439d@news.astraweb.com> <579ccc68$0$1583$c3e8da3$5496439d@news.astraweb.com> <579d5e2d$0$1612$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:112115 On Sat, Jul 30, 2016, at 22:10, Steven D'Aprano wrote: > "while True" doesn't merely emulate an infinite loop, it implements an > infinite loop without needing dedicated syntax, byte-code or > implementation. Er, it's not like it would need dedicated byte code anyway. The bytecode of an infinite loop is just an unconditional backward jump*, which we already have. The peephole optimizer already takes care of it (which _could_ be considered dedicated implementation; even if it's general enough to also work with "if True", how many of those do you figure there really are?) One argument that exists in favor of a dedicated infinite loop (and dedicated finite repetition loop) syntax, which I don't personally think applies to Python, is that the condition (and the whole construct for "for i in range", for finite repetitions) means additional concepts that have to be introduced at the same time to people being taught programming for the first time. *in fact, the bytecode of while already contains an unconditional backward jump; there's a conditional forward jump at the top - which is eliminated, I assume by the peephole optimizer, when the loop condition is a truthy constant.