TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

MonkeyType: A system for Python that automatically generates type annotations

104 pointsby chenzheklabout 5 years ago

12 comments

Bnshsysjababout 5 years ago
While I really like type annotations I hate that they’re little more than IDE hints.<p>There’s nothing to stop calling functions with incorrect datatypes at runtime and I’d consider this one of the single biggest weaknesses of python right now
评论 #22646294 未加载
评论 #22646133 未加载
评论 #22648288 未加载
评论 #22648125 未加载
评论 #22646296 未加载
评论 #22647364 未加载
评论 #22646293 未加载
评论 #22647519 未加载
heavenlyblueabout 5 years ago
What are your thoughts on purely static tools on that for Python?<p>Basically my latest project that I was thinking about is to write a symbolic executor for python that would simply preserve all of the required-type information for all of the execution paths of the program.<p>Also the other project is to write a tool that allows you to walk all of the possible executions of a given piece of code to find which functions are being called from it - incredibly useful for refactoring of the old code.<p>Does something like this exists already that you&#x27;ve used and found useful?
评论 #22646336 未加载
评论 #22646372 未加载
评论 #22647552 未加载
Epskampieabout 5 years ago
I think I’ve seen several of these now for python, seems very useful.<p>I hope a good one will be made soon for javascript&#x2F;typescript.<p>Or maybe it’s needed less there because of typescripts type interference?
评论 #22646545 未加载
anentropicabout 5 years ago
I will definitely check this out!<p>Very similar is <a href="https:&#x2F;&#x2F;google.github.io&#x2F;pytype&#x2F;" rel="nofollow">https:&#x2F;&#x2F;google.github.io&#x2F;pytype&#x2F;</a> which also infers and adds annotations, as well as providing a type checker which in some ways works better than mypy (recursive types!)
garrettgrimsleyabout 5 years ago
Previous discussion: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15982390" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15982390</a>
FpUserabout 5 years ago
Not Python exactly but I have these situation. I am writing business server in C++ that exposes JSON based RPC API and Javascript client library to access said API.<p>I have no idea where is that claim about high productivity of these free form languages came from. In C++ in addition to the nice intellisense compiler checks everything before sending program to debug. So I do not need to do manual testing during runtime to discover typo in my code.<p>In javascript I can write literally any crap and the system lets it go. Intellisense sucks big time as well. As a result of this and usual typos I have to literally go and do a lot of clicking to see if this part blows up at runtime.<p>So all in all I&#x27;d say productivity in C++ is way better. And C++ is not a stellar example of easy language. Actually it is easy for me. Not because I am super-duper programmer but your basic coding with the help of standard library is a piece of cake. I do not really need to be an architecture astronaut and dive into any esoteric stuff. Simply not needed
评论 #22648256 未加载
plaflabout 5 years ago
Awesome. I will try this next Monday on a code base at work, I hope it will improve readability. I admit I&#x27;m a little skeptical about the adoption of optional typing if it&#x27;s not going to affect performance but maybe this will change my mind.
mkchoi212about 5 years ago
Haven’t been involved in the Python community for awhile but isn’t already a thing? Really cool project but thought I saw something like this already existed. If I’m right, is there anything that stands this apart from its counterparts?
Browunabout 5 years ago
What&#x27;s the benefit of this over simply adding the type annotations directly? I guess this is mostly for those unwilling to understand types? Especially given the admitted limitations of inferring types, such as the add exmaple discussed; this seems to be fixing an anti-pattern problem. As this those who would build a project in Python that would largely benefit from these annotations, would be most suited to just spend the couple of hours needed to truly apply it themselves.
评论 #22646155 未加载
评论 #22648122 未加载
评论 #22646139 未加载
lmeyerovabout 5 years ago
Is there any level of growing community consensus on a types&#x2F;contracts-for-python effort?
asplakeabout 5 years ago
Nice! I see some Django-related FAQs. Anyone used this with Flask?
评论 #22646064 未加载
rajbiswas125about 5 years ago
Would python finally become statically typed?
评论 #22646185 未加载