Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.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.05; 'class,': 0.07; 'detect': 0.07; 'modified': 0.07; 'aliases': 0.09; 'method,': 0.09; "people's": 0.09; 'wrapper': 0.09; 'cc:addr :python-list': 0.11; 'jan': 0.12; "wouldn't": 0.14; 'bool': 0.16; 'check?': 0.16; 'detected': 0.16; 'distinct': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instance;': 0.16; 'operator.': 0.16; 'subclass': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'things.': 0.19; 'seems': 0.21; 'memory': 0.22; 'example': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'andrew': 0.30; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'comparison': 0.31; 'class': 0.32; 'totally': 0.33; 'skip:_ 10': 0.34; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'false': 0.36; 'searching': 0.37; 'rather': 0.38; 'ability': 0.39; 'even': 0.60; 'break': 0.61; 'new': 0.61; 'simple': 0.61; 'making': 0.63; 'name': 0.63; '2015': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=m0ZAsLi+8V1CHfx6qm6re5wnPYWCuVWvO3251jPybh8=; b=YD52nMtgobrdRpMzkfQMca4ml+UusKSK4Sp14H2ASJD5djT446FRZxtjgmkAg2iNRG dpLSkbqtOAeRhBVLNlLC/PN+PLsm8Wp6SMg7w5awsMa1GfOr45Ux8vfMnEbT+znyFeZ+ pWE1Dx8wQt4b0r1lKHskIF8aQOdfxvVGuEZjy2Is4DfBlCxaEy5myuHOwgq1PEd6Nh7B +ix0PXg4IfHBOIumFwh5mGB/QERbB4DC2/5GihiwffLtQr1l/mpN3BTIHmYRlFLU1quS 8kl8Si4vAnMQ6YRXKcv6c8SKZF/y1GkUmHaMbWh5cIMpMkoaSbxTYhJ/4UFVwFZNJKRW gLcQ== MIME-Version: 1.0 X-Received: by 10.50.61.238 with SMTP id t14mr16250650igr.34.1420551349897; Tue, 06 Jan 2015 05:35:49 -0800 (PST) In-Reply-To: <54ABE383.3020801@r3dsolutions.com> References: <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> Date: Wed, 7 Jan 2015 00:35:49 +1100 Subject: Re: Comparisons and sorting of a numeric class.... From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1420551359 news.xs4all.nl 2839 [2001:888:2000:d::a6]:44093 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83269 On Wed, Jan 7, 2015 at 12:30 AM, Andrew Robinson wrote: > Why this is so important to Guido, I don't know ... but it's making it VERY > difficult to add named aliases of False which will still be detected as > False and type-checkable as a bool. If my objects don't type check right -- > they will likely break some people's legacy code... and I really don't even > care to create a new instance of the bool object in memory which is what > Guido seems worried about, rather I'm really only after the ability to > detect the subclass wrapper name as distinct from bool False or bool True > with the 'is' operator. If there were a way to get the typecheck to match, > I wouldn't mind making a totally separate class which returned the False > instance; eg: something like an example I modified from searching on the > web: Okay, so why not just go with your own class, and deal with the question of the type check? Simple solution: Instead of fiddling with __gt__/__lt__, create your own method, and use your own comparison function to sort these things. ChrisA