Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83659

Re: Comparisons and sorting of a numeric class....

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'true,': 0.05; 'methods,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'bool': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instantiated': 0.16; 'itself,': 0.16; 'singleton': 0.16; 'subclass': 0.16; 'subclasses': 0.16; 'subclassing': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'implementing': 0.19; 'normally': 0.19; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; "d'aprano": 0.31; 'exceptions': 0.31; 'steven': 0.31; 'class': 0.32; 'another': 0.32; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'pm,': 0.38; '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=5aZ65DFrtgBOZztOcwMBOcz/6fRnK/fiMCQnLTgjtj4=; b=uhqqBE0jMAxhql0YZDP9biA1sBySa1zb2ccAuN6wa/yWdteYTvmXt9mNtaBxqfPEZi 9y+jdlHQpzRd0IjYpNXKOSd33fvXkbLVsqKWnIoXXOJ7OHyNGZkx3tJDJL7UGBj7x/r7 gftwsscEMW1LJQ7Bcnfxlpy8FWz+bR5p+Ipuhrv8gX3kqoR+yufbOr0sD9V5PsmAfEza KTdAKTonYqTGXQmi8GaecEgvrwEnoCN7P3AWZtDCwfF1DjAH8Ze96HzlHgs9G6ScKEJS c87FxvuZaLQrODRJ3Nh9TFQED6iZA2Jwpl4lHkduJY1WrsH90pUH3AjhFxnoFlxfU7Pq U+cA==
MIME-Version 1.0
X-Received by 10.42.94.14 with SMTP id z14mr26411521icm.59.1421127054090; Mon, 12 Jan 2015 21:30:54 -0800 (PST)
In-Reply-To <54b4a5ac$0$2738$c3e8da3$76491128@news.astraweb.com>
References <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> <CAPTjJmpktyHfghEr+cjPrhso7JgB4VfS4=5Gdi95gT0aFbSYGA@mail.gmail.com> <54AC97D9.4010504@r3dsolutions.com> <CAPTjJmooTK_+HVoeyeSrqBHN1=YjRYQ2kfDyQtL9JoA9SbTqsQ@mail.gmail.com> <54ACAA04.60801@r3dsolutions.com> <54ADC99F.3020405@stoneleaf.us> <54B44A64.7010105@r3dsolutions.com> <mailman.17645.1421102146.18130.python-list@python.org> <54b4a5ac$0$2738$c3e8da3$76491128@news.astraweb.com>
Date Tue, 13 Jan 2015 16:30:53 +1100
Subject Re: Comparisons and sorting of a numeric class....
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17654.1421127061.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1421127061 news.xs4all.nl 2846 [2001:888:2000:d::a6]:44766
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83659

Show key headers only | View raw


On Tue, Jan 13, 2015 at 3:57 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> On Tue, 13 Jan 2015 09:35:43 +1100, Chris Angelico wrote:
>
>> Subclassing bool breaks this invariant, unless you never instantiate the
>> subclass, in which case it's completely useless.
>
> Not necessarily. A class that you never instantiate, but use as an object
> itself, is another way of implementing the singleton design pattern.
> Obviously all the methods have to be class methods, but it is doable.
>
> But wacky exceptions like subclasses that aren't instantiated aside,
> normally if you subclass something you intend to instantiate it.

True, I should have said "probably useless" instead of "completely
useless". :) There's always *something* you could do with it.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-13 09:35 +1100
  Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve@pearwood.info> - 2015-01-13 04:57 +0000
    Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-13 16:30 +1100

csiph-web