Improvements for bitwise, logical and comparison operators#6
Improvements for bitwise, logical and comparison operators#6mattgreen merged 11 commits intomattgreen:masterfrom mheinzel:bitwise-and-boolean-operators
Conversation
|
I implemented equality and comparison for many different types. There is some duplication between And I got chained comparison operators down! Such a good feeling. 😄 |
|
Sorry for the delay, I've been on vacation and am still getting back into real life. :) Great work on all of these! I need to study some of the commits some more. |
|
No problem, just take your time! If there is anything unclear or you are not happy with something, don't hesitate to ask me about it. |
1 ^ 2 ^ 3works now.Logical operators (or, and) only evaluate the second argument if necessary (short-circuiting). This also works with truthiness.
You can see examples for these things in the tests I added.
I am currently working on comparisons, there is a lot missing (e.g. comparison of bools, lists, strings, equality of sets and lists). I think it would be best to base it on the methods
__eq__()etc., but that would require some work.Also, chained comparison is not supported yet (e.g.
1 < 2 < 3 > 0). I am thinking about it, but it's not really straight-forward to implement.Generators, list/generator/tuple comprehensions, and splat/star-args are waiting as well, so there is enough to do :D
Matthias