On Mar 12, 2013, at 19:04, Random832 <random832@fastmail.us> wrote:
On 03/12/2013 09:43 PM, Andrew Barnert wrote:
You also need negated values, or there's no way to write "background &= ~Color.RED". So, "~Color.RED" has to be something. No, you don't. I started saying the same thing (then got sidetracked into trying to define it as a general operation on sets, then abandoned the idea as silly) in my last, but.... why not just background -= Color.RED? Just like sets.
Which means, as I said in another message, that Day.FRIDAY - Day.WEDNESDAY is not 2, but Day.FRIDAY. Which I'm pretty sure most people would find surprising. Unless you want bitmask and ordered int enums to be different types, I don't see a good way around this. A type that acts like a set and also like a number has conflicting intuitive meanings for most of its operators. The only reason you don't notice this for the obvious ones | and & is that those two set operations mean the same thing as the int operations (when thinking of an int as a set of bits); that's not true for any operators other than the bitwise ones.
It's different from C, but that's not necessarily a bad thing. _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas