Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin.stu.neva.ru!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'defaults': 0.07; 'arguments,': 0.09; 'false,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; 'accepting': 0.14; '(true,': 0.16; '11:19': 0.16; 'arg': 0.16; 'args,': 0.16; 'args.': 0.16; 'closure,': 0.16; 'i\xe2\x80\x99m': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:More': 0.16; 'travis': 0.16; 'wrote:': 0.18; '(the': 0.22; 'feb': 0.22; 'example': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'define': 0.26; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'sets': 0.30; 'implicit': 0.31; 'subject:other': 0.31; 'quite': 0.32; 'device': 0.34; 'maybe': 0.34; "can't": 0.35; 'but': 0.35; 'really': 0.36; 'useful': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tell': 0.60; 'received:173': 0.61; 'providing': 0.61; 'making': 0.63; 'different': 0.65; 'between': 0.67; 'useful.': 0.68; '2014,': 0.84; 'functions)': 0.84; 'received:fios.verizon.net': 0.84; 'subject:!)': 0.84; 'subject:via': 0.84; 'widen': 0.84; 'difficult,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!) Date: Tue, 11 Feb 2014 12:57:24 -0500 References: <85c2698c-d681-4511-b111-bb1e549ece93@googlegroups.com> <52f9c392$0$11128$c3e8da3@news.astraweb.com> <4E8B29DC-F3A3-44A4-B912-9438CE56B3F2@gmail.com> <0FBEAFE1-409D-4FFA-B332-34DBE81072C8@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <0FBEAFE1-409D-4FFA-B332-34DBE81072C8@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392141477 news.xs4all.nl 2948 [2001:888:2000:d::a6]:51684 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65934 On 2/11/2014 11:19 AM, Travis Griggs wrote: > > On Feb 11, 2014, at 7:52 AM, Chris Angelico wrote: > >> So in that situation, the no-args call does make sense. Of course, >> this is a call to a function that does take args, but it's accepting >> all the defaults and providing no additional content. It's quite >> different to actually define a function that mandates exactly zero >> arguments, and isn't making use of some form of implicit state (eg a >> closure, or maybe a module-level function that manipulates >> module-level state - random.random() would be an example of the >> latter). Syntactically, Python can't tell the difference between >> "print()" and "foo()" where foo can never take args. > > So at this point, what I=E2=80=99m reading is that actually making a =E2= =80=9Cno arg function=E2=80=9D is difficult, if we widen the semantics. It is quite easy. def f(): return 3 # or any other constant. Chris said that useful functions in Python are (mostly) not really=20 niladic, which is equivalent to saying that niladic functions in Python=20 are (mostly) not really useful. They are a mainly a device in pure=20 function theory to have constants (True, False, 0, 1, ...) while also=20 having everything be a function (the 'pure' part). Pure set theory uses = its own tricks to make the same constants (and functions) be sets ;-). --=20 Terry Jan Reedy