Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Re: [Solved] Programming Bitcoin , Jimmy Song. ecc.py functions aren't working
by
n0nce
on 19/01/2022, 02:58:10 UTC
⭐ Merited by ETFbitcoin (2)
I see you solved your issue, however there was one thing I want to point out.
The Python error messages actually tell you a lot about what's going wrong, to the point where I could figure out some of the issues completely statically. One example is where it's telling you that the function __add__ is not defined. We can see in your code that your indents are all over the place, putting the __add__ function within the __ne__ function, so it's invisible (nonexistent) from the outside.
Quote
To be safe I copied and pasted functions from answers.py into ecc.py . The problem still persists
Picture 1: https://i.stack.imgur.com/Cihsv.jpg
Picture 2: https://i.stack.imgur.com/tlIig.jpg
Picture 3: https://i.stack.imgur.com/gQHf9.jpg

Also here, it directly tells you your indent is off and you seem just not to read these error messages. They exist for a reason.
Quote

I think that Jimmy Song here wanted to make readers implement everything in a TDD way, which is a very good idea and teaches learners a lot about the language itself and how to develop cleanly. You make use of the test framework by writing tests beforehand according to spec / concept, then develop until your tests are all 'green'.