Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'api': 0.11; 'python': 0.11; "wouldn't": 0.14; 'backwards': 0.16; 'behaviour.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'googling': 0.16; 'naming': 0.16; 'rarely': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recipes': 0.16; 'renaming': 0.16; 'module': 0.19; 'any,': 0.19; 'stefan': 0.19; 'not,': 0.20; 'solution.': 0.20; 'seems': 0.21; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'generally': 0.29; '(like': 0.30; 'probably': 0.32; 'url:python': 0.33; 'case,': 0.35; 'received:84': 0.35; 'acceptable': 0.36; 'url:org': 0.36; 'should': 0.36; 'positive': 0.37; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'realize': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'is.': 0.60; 'negative': 0.60; 'url:5': 0.61; 'url:3': 0.61; 'first': 0.61; 'making': 0.63; 'skip:n 10': 0.64; 'believe': 0.68; 'debate': 0.68; 'obvious': 0.74; 'irrelevant': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: GCD in Fractions Date: Tue, 23 Sep 2014 19:26:27 +0200 References: <54216c8e$0$29966$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-021-004.084.056.pools.vodafone-ip.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411493200 news.xs4all.nl 2854 [2001:888:2000:d::a6]:55832 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78230 Wolfgang Maier schrieb am 23.09.2014 um 18:38: > While at first I thought this to be a rather irrelevant debate over module > private vs public naming conventions, I now think the OP is probably right > and renaming fractions.gcd to fractions._gcd may be a good idea. Making a public API private is rarely a good idea. It should be enough in this case to document the behaviour. And, believe it or not, it actually is documented: https://docs.python.org/3.5/library/fractions.html#fractions.gcd > Googling for recipes to calculate the gcd using python brings up > fractions.gcd as a general answer (like at stackoverflow: > http://stackoverflow.com/questions/11175131/code-for-greatest-common-divisor-in-python) > and it is not obvious for non-mathematicians to realize that it is NOT a > generally acceptable solution. It is. Certainly for positive numbers, which clearly present the majority of use cases. It's definitely the "normal" use case, wouldn't you say? For negative numbers, the "expected" behaviour seems to be unclear, so the current behaviour is just as good as any, so backwards compatibility concerns clearly win this fight. Stefan