I've been going through elliptic curve point addition described in chapter two of Jimmy Song's Programming Bitcoin.
Point addition satisfies certain properties that we associate with addition, such as: • Identity • Commutativity • Associativity • Invertibility Identity here means that there’s a zero. That is, there exists some point I that, when added to a point A, results in A: I + A = A We’ll call this point the point at infinity (reasons for this will become clear in a moment). This is related to invertibility. For some point A, there’s some other point –A that results in the identity point. That is: A + (–A) = I Visually, these points are opposite one another over the x-axis on the curve [...] [...] To code point addition, we’re going to split it up into three steps:
- Where the points are in a vertical line or using the identity point
- Where the points are not in a vertical line, but are different
- Where the two points are the same Coding Point Addition We first handle the identity point, or point at infinity. Since we can’t easily use infinity in Python, we’ll use the None value instead.
My question is about case 1 (vertical line). Why not represent infinity with
float('inf')
instead of with None
? Why would it or wouldn't it work in Python?