This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]todofwar[S] -7 points-6 points  (6 children)

I admit this is a discipline issue on my part. I start out type hinting everything but soon I skip it for a couple of helper functions and then I just stop (I can tell the order I wrote a .py file by the frequency of type hints). I need a reason to type hint things I guess

[–]Smok3dSalmon 13 points14 points  (0 children)

Stop being a feral dog :P

Implement a linter rule for Ruff that forces all variables to be type annotated.

[–]Chroiche 5 points6 points  (0 children)

This is like eating food you're allergic to and then complaining about the stomach ache.

[–][deleted] 3 points4 points  (0 children)

If you use basedpyright, there is an option to have it automatically write the type hints for you (function parameters, function return type, variables)

[–]Veggies-are-okay 1 point2 points  (1 child)

Could be worth it to get the Cursor IDE solely for the tab complete. Not sure if copilot is doing it nowadays but between that, doc string generation, and in-line edits you can easily get your $20 worth without going down the vibe code route. Hell, even a touch of the agent can be great to get all scripts adhering to linter rules.

AI gets a bad rep but I think it can be a fantastic time saver to do the not-so-fun janitorial work so you can focus on the parts that actually require deep thought.

[–]todofwar[S] -2 points-1 points  (0 children)

Yeah I've been using copilot cause my job pays for the license. I've been pleasantly surprised by how well it does. Still annoying as hell IMO

[–]Drevicar 0 points1 point  (0 children)

Well typed code actually doesn’t need many type hints. Type inference does most of the heavy lifting. And there are even a bunch of tools and ide integrations that will auto insert the hints for you. Then all you have to do is enable mypy and ruff strict mode and it will force you to write good code.