Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'guido': 0.04; '(although': 0.05; 'instance': 0.05; 'suppose': 0.05; 'received:verizon.net': 0.07; 'variable,': 0.07; 'argument,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'rule.': 0.09; 'underlying': 0.09; 'api': 0.11; 'wrote:': 0.15; 'library': 0.15; '(usually,': 0.16; 'enigma': 0.16; 'flag,': 0.16; 'kern': 0.16; 'literals': 0.16; 'received:east.verizon.net': 0.16; 'always,': 0.16; 'argument': 0.16; 'case.': 0.16; 'pm,': 0.16; 'interesting.': 0.19; 'header :In-Reply-To:1': 0.22; 'literal': 0.23; 'suspect': 0.25; 'function': 0.26; "i'm": 0.27; 'pass': 0.28; '(the': 0.28; 'constant': 0.29; 'interpret': 0.29; 'yet': 0.30; 'andrew': 0.32; 'typically': 0.33; 'usually': 0.33; 'actually': 0.33; 'to:addr :python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header :User-Agent:1': 0.34; 'however,': 0.34; 'rule': 0.34; 'quite': 0.34; 'agree': 0.35; 'that,': 0.35; 'flag': 0.35; 'latter': 0.35; 'like:': 0.35; "isn't": 0.35; 'skip:o 20': 0.36; 'functions.': 0.37; 'but': 0.37; 'several': 0.37; 'using': 0.37; 'another': 0.38; 'received:org': 0.38; 'takes': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'two': 0.38; 'put': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'where': 0.40; 'our': 0.63; 'world': 0.65; 'direct': 0.66; 'believe': 0.66; 'subject:!': 0.67; 'violate': 0.84; 'eco': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: PyWart: os.path needs immediate attention! Date: Sat, 30 Jul 2011 23:31:22 -0400 Organization: The Church of Last Thursday References: <14874f59-a836-4031-a8c9-6b24f4d5e812@d7g2000vbv.googlegroups.com> <4e335535$0$29975$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: static-96-239-182-58.ronkva.east.verizon.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <4e335535$0$29975$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312083097 news.xs4all.nl 23850 [2001:888:2000:d::a6]:39162 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10612 On 7/29/11 8:50 PM, Steven D'Aprano wrote: > Andrew Berg wrote: > >>>>>> os.path.exists(path, ignoreSymLnks=False) >> I actually agree with you on these, which I suppose is interesting. > > > Guido has a rule of thumb: "No constant arguments". Or another way to put > it: if a function takes an argument which is nearly always a constant > (usually, but not always, a flag) then it is usually better off as two > functions. That's not quite right (although I can never find a direct quote from Guido whenever I need to dissect the niceties of the rule). The rule of thumb is more like: "No literal arguments." That is, if you are typically going to use True and False literals for a flag, it's better to have two functions. However, if you have a suite of interoperating functions with the same flag argument, and one might reasonably want to pass the same flag value to several different calls using a variable, that's a reasonable use. > But having said that, I'm currently writing a library where nearly all the > functions violate the No Constant Argument rule. (The API isn't yet stable, > so I may still change my mind.) Make of that what you will. I suspect this may be an instance of the latter case. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco