Antoine Pitrou added the comment: Indeed, the definition and use of __index__ has derived since PEP 357. Nowadays, __index__ means "can be converted to an int without loss".
In any case, I find the behaviour of your "logical type" a bit dubious. If it's like bool but ternary, it *should* convert to int (or perhaps be an int subclass like bool). ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19988> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com