On Sun, Dec 20, 2020 at 11:59:36PM -0800, Paul Bryan wrote:
I've worked around it by storing tuple(type, value) in the set, which is fugly. Yes, I need mixed types in the set, and I'm using the set for efficient lookup.
An alternative, which may be better or worse but is probably worth considering, is to create your own wrapper proxy for True and False, then use that.
It's probably a bit more effort up front (you need a proxy class that wraps True and False, a pair of constants TRUE, FALSE, and probably a dict subclass which replaces every True/False key with TRUE/FALSE) but once you have that you can go back to just using the object as key without bothering with the redundant type and tuple.