Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder5.xlned.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; 'python,': 0.02; 'operator': 0.03; 'argument': 0.04; 'error:': 0.05; '[],': 0.07; 'function,': 0.07; 'subject:code': 0.07; 'python': 0.09; 'accepts': 0.09; 'incorrect': 0.09; 'operator,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spelling': 0.09; 'unexpected': 0.09; 'wrong,': 0.09; 'language': 0.14; 'file,': 0.15; "hasn't": 0.15; '"cannot': 0.16; '-eq': 0.16; 'assumptions': 0.16; 'confusion': 0.16; 'included,': 0.16; 'obviously,': 0.16; 'operators.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'statement.': 0.16; 'unsafe': 0.16; 'string': 0.17; '>>>': 0.18; 'script': 0.24; '[1]': 0.27; 'recognized': 0.27; 'wonder': 0.27; 'question': 0.27; 'interface': 0.27; 'correct': 0.28; 'header:X-Complaints-To:1': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'convert': 0.29; 'basic': 0.30; 'could': 0.32; 'getting': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'false': 0.35; 'path': 0.35; 'sequence': 0.35; 'doing': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'compare': 0.36; 'visual': 0.36; 'should': 0.36; 'charset :us-ascii': 0.36; 'bad': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'results': 0.65; 'jul': 0.65; "'2'": 0.84; "'true'": 0.84; 'bitten': 0.84; 'dennis': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: code review Date: Mon, 02 Jul 2012 01:20:14 -0400 Organization: > Bestiaria Support Staff < References: <4fefb0ad$0$29988$c3e8da3$5496439d@news.astraweb.com> <4fefcf72$0$29988$c3e8da3$5496439d@news.astraweb.com> <4fefedd8$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ff0f939$0$29988$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-26-114.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES 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: 106 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341206422 news.xs4all.nl 6869 [2001:888:2000:d::a6]:46774 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24764 On 02 Jul 2012 01:28:25 GMT, Steven D'Aprano declaimed the following in gmane.comp.python.general: > > When you make unsafe assumptions about an operator, and get bitten by it, > the *correct* conclusion should be that the assumption was wrong, not > that the language is wrong. > Well, to be fair, the assumption is not about "an operator" but about a sequence of operators. I don't think there was any question that "<" was not a "less than comparison" operator. OTOH: consider >>> 5 ^ 2 7 >>> 1 < 3 < 5 True >>> 3 < 5 < 1 False >>> True < 1 False >>> vs > 5 ^ 2 [1] 25 > 1 < 3 < 5 Error: unexpected '<' in "1 < 3 <" > TRUE < 1 [1] FALSE > vs ? 5 ^ 2 25 ? 1 < 3 < 5 True ? 3 < 5 < 1 True ? True < 1 True vs PS E:\UserData\Wulfraed\My Documents> 5 ^ 2 Unexpected token '^' in expression or statement. At line:1 char:3 Unexpected token '2' in expression or statement. At line:1 char:5 PS E:\UserData\Wulfraed\My Documents> 1 -lt 3 -lt 5 False PS E:\UserData\Wulfraed\My Documents> 1 -lt 5 -lt 3 False PS E:\UserData\Wulfraed\My Documents> 1 -lt 5 True PS E:\UserData\Wulfraed\My Documents> True -lt 1 The term 'True' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:5 + True <<<< -lt 1 + CategoryInfo : ObjectNotFound: (True:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS E:\UserData\Wulfraed\My Documents> 'True' -lt 1 False PS E:\UserData\Wulfraed\My Documents> 1 -lt 'True' Bad argument to operator '-lt': Could not compare "1" to "True". Error: "Cannot convert value "True" to type "System.Int32". Error: "Input string was not in a correct format."". At line:1 char:6 + 1 -lt <<<< 'True' + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : BadOperatorArgument PS E:\UserData\Wulfraed\My Documents> $True -lt 1 False PS E:\UserData\Wulfraed\My Documents> $True -eq 1 True Python, R, Visual Basic 6, PowerShell 2, respectively. Obviously, someone coming over from VB or R who hasn't read the Python reference is going to wonder why they are getting incorrect results when doing exponentiation (Isn't there an interface from Python to R? Now there is confusion in the making!) {Hmmm... R accepts BOTH 5 ** 2 and 5 ^ 2 for exponentiation} -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/