ethereum / ethereum/py_ecc

Add FQP.copy()

Open
#46 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
231
Forks
88
PR merge metrics
No merged PRs in 30d

Description

For a follow-up PR: I think this could be made a tiny bit more readable by adding a `copy()` method that takes the new coefficients, turning the line into:
```py
return self.copy([x + y for x, y in zip(self.coeffs, other.coeffs)])
```

From the current:
```py
return type(self)([x + y for x, y in zip(self.coeffs, other.coeffs)], self.curve_name)
```

_Originally posted by @carver in https://github.com/ethereum/py_ecc/pull/41_

Contributor guide

Open the contributing guide

Research direction

Start at the FQP class and its coefficient addition implementation. Confirm how instances preserve their curve information, then add the requested copy() entry point and use it for the shown expression. Done means the addition path uses copy() with the new coefficients and the existing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cryptography
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.