Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'subject:question': 0.08; 'python': 0.09; 'wrong,': 0.09; 'bug': 0.10; 'language': 0.14; 'boolean': 0.16; 'hashes': 0.16; 'md5': 0.16; 'wrote:': 0.17; 'fixed.': 0.17; '>>>': 0.18; 'skip:" 30': 0.20; 'people,': 0.21; 'regardless': 0.21; 'raise': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; '(e.g.': 0.27; 'fixed': 0.28; 'chris': 0.28; '>>>>': 0.29; 'cases.': 0.29; 'comparison': 0.29; 'strings,': 0.29; 'subject:some': 0.29; 'probably': 0.29; "i'm": 0.29; 'subject:Simple': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'entry': 0.33; 'compared': 0.35; 'false': 0.35; 'pm,': 0.35; 'received:192.168.0': 0.35; 'something': 0.35; 'but': 0.36; 'compare': 0.36; 'should': 0.36; 'rather': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'some': 0.38; 'sure': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'think': 0.40; 'most': 0.61; 'kind': 0.61; 'back': 0.62; 'between': 0.63; 'worth': 0.63; 'talking': 0.66; 'saw': 0.75; 'skip:! 30': 0.84; 'numbers:': 0.91 Date: Sun, 28 Oct 2012 23:30:22 -0500 From: Evan Driscoll User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Re: Simple Python question for some References: <00c501cdb567$28ead530$7ac07f90$@gmail.com> In-Reply-To: X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351485346 news.xs4all.nl 6969 [2001:888:2000:d::a6]:36335 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32338 On 10/28/2012 7:18 PM, Chris Rebert wrote: > This is fixed in Python 3, where such nonsensical comparisons will > instead raise TypeError. It's worth pointing out that at least one kind of inequality comparison which some people (e.g. me) would consider nonsensical is still allowed in Python 3, which is between Boolean values and numbers: >>> True < 1 False >>> False < 1 True which is probably because >>> True == 1 True >>> False == 0 True Many people (probably most people, to be honest) disagree with me that this is wrong, but regardless of whether you like it or not you need to know what happens in such cases. On 10/28/2012 7:18 PM, Chris Angelico wrote: > Which means that strings will ALWAYS be compared as strings, and > numbers will ALWAYS be compared as numbers, and ne'er the twain shall > conflict. I can trust Python to compare MD5 hashes reliably: > >>>> "912128034267498495410681495015e0" !=00912128034267498495410681495015" > True > > Of course, I'm not pointing fingers at any other languages here, but > this is a known security hole in one rather widely-used one. If you are PerHaPs talking about the language I think you are, my favorite fact about that is I'm that I think a while back I saw a bug entry about something like that and they weren't sure how or even if it should be fixed. Evan