On Fri, Jan 3, 2014 at 3:16 PM, Ethan Furman <et...@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 -- https://mail.python.org/mailman/listinfo/python-list