spacetelescope / braindump

A place to collect notes from code discussions
2 stars 5 forks source link

Python type hinting discussion #16

Open stscieisenhamer opened 7 years ago

stscieisenhamer commented 7 years ago

Be great to have a discussion of the if/how/when/why of using the new Python type hinting. Even if its the short "nope".

eteq commented 6 years ago

I (@eteq) knows a bit about this - could present if need be.

pllim commented 4 years ago

https://docs.python.org/3/library/typing.html and https://github.com/python/mypy

I volunteer @jbcurtin

jbcurtin commented 4 years ago

I'd like to hear @eteq comments on this. I'm pretty all over the place with my typing usage and I haven't really integrated mypy or black into my process yet. At the end of the day mypy enforces the annotations(typing) you write in your scripts so that you're not crossing data types in the same var-containers. I violate this with common statements like:

datum: typing.Dict[str, typing.Any] = {'data': []}
datum: typing.List[str] = datum['data']

☝️ maybe valid for mypy, but I wouldn't know

pllim commented 1 year ago

People are adopting it but not all packages support it. Python still not going to enforce it natively. Still a little controversial.