Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(at': 0.04; 'float': 0.07; 'suppose': 0.07; 'false.': 0.09; 'instance.': 0.09; 'propagate': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; "(i'm": 0.16; '__getitem__,': 0.16; '__new__': 0.16; 'argument,': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inability': 0.16; 'inheritance': 0.16; 'least)': 0.16; 'nan': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; "haven't": 0.24; 'looks': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'class.': 0.26; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'class': 0.32; 'probably': 0.32; 'call.': 0.33; 'fri,': 0.33; 'actual': 0.34; 'could': 0.34; 'info': 0.35; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'crazy': 0.36; 'done': 0.36; "i'll": 0.36; 'possible': 0.36; 'should': 0.36; 'pm,': 0.38; 'itself': 0.39; 'sure': 0.39; 'either': 0.39; 'applicable': 0.60; 'expression': 0.60; 'real': 0.63; 'production': 0.68; 'lose': 0.68; 'online': 0.71; 'acts': 0.74; 'can...': 0.84; 'ethan': 0.84; 'examples.': 0.84; 'furman': 0.84; 'to:none': 0.92; 'inheritance,': 0.93; 'ultimate': 0.93 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=/aKc3juKCmtjx/YPRGAJ8k37zMZ+lI2UU6oc5MApmX0=; b=hFfZCzfvJNZ7q5kNplswmszlJ4PNdmTJ1bRJoyMUHuLhz2ECnhHdVzjHdeDx4KeBWI pGE7EhnaddgUiFixVFbBHXVVyqm7poyPbz0SkLdrYydLp5jup2oOvBc0tuO9q2tdv0ed cGtfjso9s62v+ewBYgXpM1zpagWl1ukC9xB4fuMJVXzWPd4yKoNGFhLX5uyUP1ZAgM3z 0/em3b92gSRmkuvsrJCrSCGbCBi4VTgiCsmgVdFOPdl5Uug8ynEb5dfSo6qXcwLJx2+X eWrIeWHkM2OUPlypahwgCcANHe1HWLoz9rO0cyirDlMbOgznyoXMTikw9dzdY79W/59C TXLw== MIME-Version: 1.0 X-Received: by 10.68.247.6 with SMTP id ya6mr86917630pbc.45.1388727325905; Thu, 02 Jan 2014 21:35:25 -0800 (PST) In-Reply-To: <52C639B3.9030909@stoneleaf.us> References: <52C59FF6.5000607@allsup.co> <52C5BD90.9020609@islandtraining.com> <52C639B3.9030909@stoneleaf.us> Date: Fri, 3 Jan 2014 16:35:25 +1100 Subject: Re: Ifs and assignments 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388727332 news.xs4all.nl 2932 [2001:888:2000:d::a6]:40613 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63038 On Fri, Jan 3, 2014 at 3:16 PM, Ethan Furman wrote: > On 01/02/2014 04:06 PM, Chris Angelico wrote: >> >> >> Here's a crazy idea. Suppose we have a "sticky falseness" that can >> quietly propagate through an expression the way a NaN can... then we >> could just float that right through the .group() call. >> >> class truth: > > An interesting idea. You'd need to add (at least) __getitem__, and I'll > probably call it `maybe`, myself. ;) I was going for something like bool(). If you pass something through bool(), you get either True or False; if you pass something through this, you get either itself or something that acts like False. >> (I'm not sure if I'm using __new__ correctly; I've never actually done >> it in production code, and the info I found online was mainly Py2 >> examples. Should that be done with super(), or is that applicable only >> once there's an actual instance with a real MRO?) > > I haven't tested it, but your __new__ looks fine. The only thing you lose > by not calling super() is the inability for cooperative multiple > inheritance, except as the ultimate base class. Is it possible to have multiple inheritance at this point, though? I get a class argument, not an instance, because there isn't an instance. ChrisA