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


Groups > comp.lang.python > #63038

Re: Ifs and assignments

References (1 earlier) <52C5BD90.9020609@islandtraining.com> <mailman.4811.1388704420.18130.python-list@python.org> <roy-8601CA.18361502012014@news.panix.com> <CAPTjJmoA130Q4+2PHLWiPp1FNaB+c6HgUTWpst4Z_qL3qqoR2w@mail.gmail.com> <52C639B3.9030909@stoneleaf.us>
Date 2014-01-03 16:35 +1100
Subject Re: Ifs and assignments
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4834.1388727330.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jan 3, 2014 at 3:16 PM, Ethan Furman <ethan@stoneleaf.us> 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

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


Thread

Re: Ifs and assignments John Allsup <pydev@allsup.co> - 2014-01-02 21:44 +0000
  Re: Ifs and assignments Roy Smith <roy@panix.com> - 2014-01-02 18:36 -0500
    Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 11:07 +1100
    Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 11:06 +1100
    Re: Ifs and assignments Ethan Furman <ethan@stoneleaf.us> - 2014-01-02 20:16 -0800
    Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 16:35 +1100

csiph-web