4 ms·
I just read your book this last week and loved it! I came here to recommend it. One thing I still struggle with, though your book helped a lot, is when you sta
by sterlinm 5y ago
I just read your book this last week and loved it! I came here to recommend it.
One thing I still struggle with, though your book helped a lot, is when you start trying to get typing right with decorators and other types of misdirection. You pretty quickly start reading through PEPs and forums and using weird hacks that may or may not be a good idea.
For example, I’ve spent a fair amount of time trying to get PyCharm to understand a classmethod property to no avail. It’s hard to know if it’s a problem with my typing, a problem with PyCharm, or something else.
Anyway, thanks for the great book!
- waogta 5y agoRelax. Per my understanding, you don't need to push yourself so hard. I come from C/C++/Java first. Then I use python. When I learn python, everyone said that the good part of python is its duck type and dynamic type. Now everyone talked about type hints. I can't express my feeling about it. Per my experience, type hints can improve your code quality if you are working with huge code base or some complex project. However, if you just write some scripts to auto some daily tasks, using type hints is a kind of over-skill.
- patviafore 5y agoThanks! If it makes you feel better, I struggle with that too from time to time -> it happens to the best of us. It's a tricky thing to balance the use of more complicated features, because sometimes it clarifies things and sometimes it makes it more complicated (and often depends on the audience). My main recommendation is to not get too hung up on fighting your tools, at some point, you run into a law of diminishing returns. I've run into bugs in tools and have sucked it up and put in a # type: ignore. But, and this is critical, I try to have a comment for future developers who might have a better way to do it, or even a link to a public bug. Remember, your main goal is communication to the future, not necessarily a strict dogmatic rigor of type adoption. That being said, I always love a good programming puzzle, so if you get stuck on something like that, feel free to reach out to me on Twitter. No promises I have the answer, but I like learning just as much as the next person.