Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 02 coding for infinity point feedback #225

Open
jwhendy opened this issue Sep 27, 2021 · 0 comments
Open

Chapter 02 coding for infinity point feedback #225

jwhendy opened this issue Sep 27, 2021 · 0 comments

Comments

@jwhendy
Copy link

jwhendy commented Sep 27, 2021

Not really an issue, but was working through the examples and noticed this combination of implementation choices:

  • on __init__() we check that both self.x and self.y are None
  • when returning, we only see if self.x or other.x are None

I was initially thinking I could break this by trying Point(None, y) or Point(x, None), but get an error as it skips the infinity point check and tries to validate that the point is on the curve:

TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and 'int'

So, for more of a python best practice question, why do something like raising a value error if the point isn't on a curve but allow this edge case to fail via a math operator error? I presume not checking if the point is actually on the curve could fail later due to calculating the slope of a point not actually on the curve, for example, but we deal with it explicitly up front.

Anyway, since this repo exists, thought I'd document the feedback. Loving the book so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant