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 21:49:09 +1000 Lines: 48 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 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de haeZUxe270g2L6uqvE2f9Qd2kAqtvffJHtrZef5CXUIg== 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; 'operator': 0.03; 'args)': 0.07; 'builtin': 0.07; 'subject:code': 0.07; 'cc:addr:python- list': 0.09; '*args):': 0.09; 'complaining': 0.09; 'here?': 0.09; 'modulo': 0.09; 'newline,': 0.09; 'subject:Why': 0.09; 'example:': 0.10; 'python': 0.10; 'language,': 0.11; 'subject:not': 0.11; '(at': 0.13; 'syntax': 0.13; 'def': 0.13; 'languages.': 0.15; "(it's": 0.16; '2016': 0.16; 'also:': 0.16; 'formatting,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'printf-style': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:allow': 0.16; 'syntactic': 0.16; 'useless': 0.16; 'write,': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'instance,': 0.18; "shouldn't": 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'meant': 0.22; 'ok.': 0.22; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'testing': 0.25; 'chris': 0.26; 'error': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'accidentally': 0.29; 'behaviour': 0.29; 'allows': 0.30; 'print': 0.30; 'supposed': 0.31; 'option': 0.31; "can't": 0.32; 'aside': 0.32; 'maybe': 0.33; 'purposes,': 0.33; 'list': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'basic': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'why': 0.39; 'where': 0.40; 'called': 0.40; 'skip:u 10': 0.61; '30,': 0.63; 'saturday,': 0.63; 'strange': 0.63; 'more': 0.63; 'other.': 0.64; 'improvement.': 0.66; 'jul': 0.72; 'special': 0.73; 'chrisa': 0.84; 'forced': 0.84; 'huh?': 0.84; 'resulted': 0.84; 'utc+5:30,': 0.84; 'to:none': 0.91; 'have.': 0.93 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 :content-transfer-encoding; bh=GVgniBv3OVZh0q6gQ0n5XVzf4J9romIACWGaFHtiFqw=; b=GLZ8ijWYI6DUOFFVGei/YDWi7Z2uvRnPGbvNpFcvbd2LUUj2ifmV/VeNjDpalgQMnz ImuKJxO7g3nU5qom9Tweq7xc774uKXqcrAhQrBSza3CYhCg7S7hR6Qandu77k+JY4MGx ufpJjTSihT2Khjag2tbeUm4mvov2dXyW/EqdpE3KgO/fpYULHiRNFEhmEw77Q3Qi/q9X oWsnmy/iFhctIQvBK+CP8GXSZtJKV3x/7rYmAqme1aruNpgshi7ZXRQTZnhciG8I8aeP Ffb6IE36bVeBjgCo3B6DnSwqIT1cfFS5GhzAjWd/45W5Q5GzusbbvRbStChcllAYyHos ca2Q== 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:content-transfer-encoding; bh=GVgniBv3OVZh0q6gQ0n5XVzf4J9romIACWGaFHtiFqw=; b=W8j3d1oUgNfLGiZ6BUb7BPfrf1WdOvL30zD11uozDKddlUOeDkPdSubanAdJ+Bxwuh 7Q5v9LW1F9aP/XNcj9EnzdPu7q+rHA8hWUkDYKgAIrhcWToGAKgVcOnv8gOVt4AH2kf6 lUumWifQMfCfN9cr+lR07flBIivGyBFFjohSwPFEKcce63yCKO+SBITz2+Es3jl8UilW ILDS9z/v8RKVl07pyB/6gxnDWjLp2v1Q/ciT1tDmVG4MO2+/0h4sEUXOaVdU2QYN7OBE rKxUrLaxg0oY+UY3c9hcwJJ4mgz0zpp4btfjpyqquaOFxulsQqOdz55jdeAIpM2k3X9O V03g== X-Gm-Message-State: AEkoouuYq1BVUvBHi46lvkvJ6lnCy/Vh5MTcRufjnjCrBOmcdy9I1wQiE3So7g9oCGegmD+uoyqPHoF0IwFS3w== X-Received: by 10.194.114.9 with SMTP id jc9mr42687046wjb.30.1469879350908; Sat, 30 Jul 2016 04:49:10 -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:112055 On Sat, Jul 30, 2016 at 9:39 PM, Rustom Mody wrote: > On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote: >> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote: >> > Anyway, if you're going to talk about annoying things forced upon you = by the >> > language, what about: >> > >> > "()" in "print (x)" for Python 3the modulo operator >> >> Why are you singling out print? It's just a function like any other. >> Are you complaining about the way function calls need parentheses? > > Its a function=E2=80=A6 ok. > Its =E2=80=98just=E2=80=99 a function=E2=80=A6 Arguable > > For example: > > - Prior Art: Its builtin and special in Fortran, Pascal, Basic And it's not built-in or special in C, or a bunch of other languages. > - More immediate : It was a special in python2 Which resulted in unmitigatable problems, such as that you can't mock it for testing or redirection purposes, and it demands syntactic magic to do its work - for instance, the only option is a "soft space" in place of a newline, where the print function allows full customization of both end=3D and sep=3D. The print function is DEFINITELY an improvement. I would also posit that an sprintf() built-in function instead of str.__mod__ would have meant there was less kickback against printf-style formatting, because it wouldn't have had the strange behaviour around single-argument use. (It's pretty simple to write, of course, but built-ins are extremely significant to perception. def sprintf(fmt, *args): return fmt % args) Syntax is NOT always an improvement. > - Poorer error catching: What was a straight syntax error is now a lint-c= atch (at best) > [print (x) for x in range(20)] Huh? Aside from the fact that you're constructing a useless list of Nones, what's the error? Also: Why is print special here? Maybe you accidentally called frobnicate on those x's and you shouldn't have. How is Python supposed to know that that's an error? ChrisA