Live data from Hacker News

Ask HN: How to become a better Python developer?

news.ycombinator.com

1–5 of 5 posts

Re: Ask HN: How to become a better Python developer?

#2
Pydoc, pytest and mypy are simple, powerful, underused tools.

@dataclass can make a lot of code cleaner than it would be otherwise.

Sum types, only available as of 3.10, make a lot of things easily expressible now that were extremely awkward previously.

Also, learn Haskell. It forces you to learn to keep most of your code pure, limiting IO to a thin top level layer, which makes testing and hence correctness a lot easier.

Re: Ask HN: How to become a better Python developer?

#4

Pydoc, pytest and mypy are simple, powerful, underused tools. @dataclass can make a lot of code cleaner than it would be otherwise. Sum types, only available as of 3.10, make a lot of things easily expressible now that were extremely awkward previously. Also, learn Haskell. It forces you to learn to keep most of your code pure, limiting IO to a thin top level layer, which makes testing and hence correctness a lot eas…

Not to nitpick, but do you mean the pattern matching statement when you are talking about "sum types"? Because as far as I'm aware Python doesn't have " proper" algebraic data types.

Re: Ask HN: How to become a better Python developer?

#5
post #4

Pydoc, pytest and mypy are simple, powerful, underused tools. @dataclass can make a lot of code cleaner than it would be otherwise. Sum types, only available as of 3.10, make a lot of things easily expressible now that were extremely awkward previously. Also, learn Haskell. It forces you to learn to keep most of your code pure, limiting IO to a thin top level layer, which makes testing and hence correctness a lot eas…

Not to nitpick, but do you mean the pattern matching statement when you are talking about "sum types"? Because as far as I'm aware Python doesn't have " proper" algebraic data types.

You're right, it doesn't, and they're still quite awwkward. And I'm not even talking about pattern matching; just the fact that you can finally define a class as `X = Y | Z`.