python-bip380 icon indicating copy to clipboard operation
python-bip380 copied to clipboard

Add PEP484 type hints

Open stickies-v opened this issue 3 years ago • 3 comments

I find PEP484 type hints make reading and debugging significantly easier for non-trivial functions. As I went through the codebase I added type hints everywhere, initially just for my understanding but then I thought you might like to have it here too so I went for full coverage.

As there is some maintenance burden I'd understand if you prefer not to merge it, it's personal preference. It's a lot of LoC changed, but type hints do not affect program behaviour so I think this can be pretty low-touch review (a wrong type hint can always be fixed later). Happy to split this up in smaller commits too if that makes it easier.

stickies-v avatar May 04 '22 22:05 stickies-v

Rebased to fix merge conflicts

stickies-v avatar May 05 '22 10:05 stickies-v

Thanks, just to let you know: i saw this PR, i'm a bit on the fence about it. I'll think about it.

darosior avatar May 05 '22 13:05 darosior

Yup no problem. I've just force pushed an update to directly import the used types to improve readability (at cost of naming collision, but the trade-off seems worthwhile here). So instead of typing.Optional[typing.List[bytes]], it's now just Optional[List[bytes]]

stickies-v avatar May 05 '22 16:05 stickies-v