jdidion / xphyle

Python library that facilitates opening, reading, and writing files (and file-like entities like URLs and streams) agnostic of compression format. (production)
Other
21 stars 3 forks source link

Update type hints to be consistent with PEP 484 #4

Closed jdidion closed 8 years ago

jdidion commented 8 years ago

Go through all functions, add missing annotations, and convert all annotations from strings to types as specified in PEP484 and https://docs.python.org/3/library/typing.html

jdidion commented 8 years ago

There is still the question of how to enforce contracts (pre/post conditions) - PEP484 does not deal with that. It looks like there are currently two libraries that handle this in different ways:

Personally, I like the codeviking syntax more, since it is closer to PEP484.

jdidion commented 8 years ago

Also pycharm types, which are specified exclusively in docstrings: https://github.com/JetBrains/python-skeletons#types

jdidion commented 8 years ago

There has also been a PEP for contracts (using docstrings): https://www.python.org/dev/peps/pep-0316/. It was deferred.

jdidion commented 8 years ago

A good intermediate step would be to use PEP484 typing for type hints, and pycontracts for optional runtime contract enforcement, since pycontracts also offers a docstring-based syntax.

jdidion commented 8 years ago

Finished adding type hinting. Closing this and opening new issues for generic classes and contracts.