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.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/AOVYNGG6FHD66A5RRKBERG6Z5TABV2T2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to