ethereum / ethereum/py_ecc

Use custom object for infinity point instead of `None`

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

Description

### What is wrong?
For #89, discussion offline:

If I call mypy --strict --follow-imports=silent --ignore-missing-imports py_ecc (without `--no-strict-optional`), then 50+ errors about "None" infinity point would show up

If I call the same command with your PR, the errors:

```
py_ecc/bn128/bn128_curve.py:63: error: 'None' object is not iterable
py_ecc/bn128/bn128_curve.py:75: error: 'None' object is not iterable
py_ecc/bls12_381/bls12_381_curve.py:66: error: 'None' object is not iterable
py_ecc/bls12_381/bls12_381_curve.py:78: error: 'None' object is not iterable
```

But it's already handled with `if is_inf(pt): return pt`

None is really tricky in typing, perhaps there should be a special constant object for infinity point?

### How can it be fixed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.