On 28 October 2016 at 23:35, Ryan Birmingham firstname.lastname@example.org wrote:
I certainly like the concept, but I worry that use of __exists__() could generalize it a bit beyond what you're intending in practice. It seems like this should only check if an object exists, and that adding the magic method would only lead to confusion.
The same can be said of using __bool__, __nonzero__ and __len__ to influence normal condition checks, and folks have proven to be pretty responsible using those in practice (or, more accurately, when they're used in problematic ways, users object, and they either eventually get fixed, or folks move on to using other APIs that they consider better behaved).
I also don't think the idea is sufficiently general to be worthy of dedicated syntax if it's limited specifically to "is not None" checks - None's definitely special, but it's not *that* special. Unifying None, NaN, NotImplemented and Ellipsis into a meta-category of objects that indicate the absence of information rather than a specific value, though? And also allowing developers to emulate the protocol for testing purposes? That's enough to pique my interest.
That's why these are my first two questions on the list - if we don't agree on the core premise that there's a general concept here worth modeling as an abstract protocol, I'm -1 on the whole idea.