AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
264 stars 78 forks source link

Point to non-point equality #53

Closed jannikluhn closed 4 years ago

jannikluhn commented 4 years ago

Checking equality of a curve point with something which is not a curve point raises a type error. Instead, I think it should return False which is, at least in my experience, the standard convention. (e.g. 5 == "5", None == object(), {} == []).

AntonKueltz commented 4 years ago

It is a bit unconventional compared to the builtin types and their comparisons, but I think it provides a clearer picture to the user as to what is going on. The cases being -

If there's a use case where this is an issue I'm happy to reconsider, but my initial thoughts here are that this provides stronger and clearer indications of what's going on than just returning False and not failing / throwing an exception.

jannikluhn commented 4 years ago

Fair enough, sounds reasonable! I just stumbled over this by accident and was a little bit surprised by the behavior, so I wanted to point it out.