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: Sat, 30 Jul 2016 22:34:24 +1000 Lines: 31 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de B/VaDU3AmcE7kQpq4GKqNwPOw6ggg9FfyWnfRfJF5OEA== 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; 'newline': 0.07; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'python:': 0.09; 'subject:Why': 0.09; 'python': 0.10; 'language,': 0.11; 'subject:not': 0.11; 'output': 0.13; 'explicitly': 0.15; 'languages.': 0.15; '2016': 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; 'write.': 0.16; 'wrote:': 0.16; '(in': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'arguments': 0.22; 'controlling': 0.22; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'fighting': 0.29; 'allows': 0.30; 'print': 0.30; 'languages': 0.34; 'received:google.com': 0.35; 'could': 0.35; "isn't": 0.35; 'should': 0.36; 'instead': 0.36; 'keyword': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'where': 0.40; 'programs': 0.62; '30,': 0.63; 'more': 0.63; 'benefit': 0.66; 'jul': 0.72; 'chrisa': 0.84; 'strengths': 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=R/8LxS8ST+tgscEK6afHGgGTmnaexGKi2BJckugekg8=; b=ZTTvygpc1O+3XTGgmeZ+yB4pjyIM5gNUJM4mHX9bWhMgPDG5hVU7LfOIQUqxkmOLha pbu/3VqoKrY3L8kFVnrrdygmcpQyO94fWcx8ewU3xrAOBdNNVpntnk5esdilvl5O2aaB VdUcFYqsjBk0wrSU3Veyvow4Aq9at7IA1F/d75NyQfIhaMAT2IhU20wkLjHsAjNUtMSh uz0FXR9osYquRTrcN++9pUrYce0sU2rDsZdcIEQ6pZjP5fa6FECsbJzmKbDi5rmod+Ks d7O4Zm97T6zr5TGcSRPvVQcfCP1KI92LdTO4DTWZlkMy5JlTpkPQYJYm629UG7a1pHKi oWiA== 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=R/8LxS8ST+tgscEK6afHGgGTmnaexGKi2BJckugekg8=; b=OR2eDsYLAhvtrs7vBPcVy5eUh8hqFat+k1aY2h6/eEBq1X8fJYrLFOGwVkurrLP4gT PHWraGpnMK/lSOguUyrgUXLQ5JQJh+IN3svue4x4yzbg78eUgrzwft8Fmcua8wuBXwY/ yqUvSjP2hMGULDL2v9HOG0s4UGbKv5zE3RvV3T+OCroLxHMFMXqc7eV2sHnZ1UeDG8mF eYyCsZnlNECkVxCcUwW3pY7nG0YPyUt0f9C59dGjPzY24rIDIClCvqaf8Mj0de1Jp9Vd wyT5rbkbFp+PTpFKydxSm92E/VuxxUsrke26dquApJb1Z0uj8I1ZN6VY6isohxTTZ6Yu xODg== X-Gm-Message-State: AEkoouv7DlWp3YLesZMV8FXSh73okyn+TzOMp3eZCDBQwU4rbYhYqFTRwtArwqxNx1glCFZybkIQLGYRsek4jA== X-Received: by 10.194.114.9 with SMTP id jc9mr42819034wjb.30.1469882066108; Sat, 30 Jul 2016 05:34:26 -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> <579B1ABB.1070500@rece.vub.ac.be> <579c2095$0$22142$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:112061 On Sat, Jul 30, 2016 at 10:27 PM, BartC wrote: >> where the print function allows full customization >> of both end= and sep=. > > > This is one thing I can never get right in Python: controlling when a > newline is or isn't generated and what happens with separators. > > (In fact when I used Python as a target language, I had to generate calls to > sys.stdout.write instead as it had more predictable behaviour.) > > So if it's the advantage of using () then it's one I never benefit from! > > Newline control should be one of the simplest things in the language, part > of the very first programs you write. > > (Some languages use 'write' or 'writeln', or 'print' or 'println'; what > could be simpler? Or you just explicitly output a "\n" string.) Here, look: print(obj) # with newline print(obj, end="") # without newline Easy, isn't it? Start playing to the language's strengths instead of fighting against them. Keyword arguments are a Python feature that I frequently yearn for in other languages. Use them! ChrisA