Hacker News new | ask | show | jobs
by paganel 1269 days ago
Yeah, that caught me off-guard, too.

I agree, though, the urllib module that he links to it's not the best thing ever when it comes to Python, and I say that as a guy who has written Python code for a living for 17 years now. But other than that I find the standard library more than ok.

The only thing that I can agree on is the slowness, but even that is relative, as we're not all writing speed-critical code. The type annotations never took off because they were, and are, basically un-pythonic, trying to force types on Python's throat, so to speak, is definitely un-pythonic. Unfortunately the "types are a silver bullet"-hype is all too real, so there's also that.

He should have also learned to love dir()-ing stuff.

3 comments

> the urllib module that he links to it's not the best thing ever

I think the reason it (and the http modules in general) has never been improved is that even when Python was young, there were better third party packages out there, but no single one of them ever got to the point where the Python devs would consider making it part of the standard library. Particularly when it comes to servers, there have always been multiple third party frameworks with significant market share. For clients, we might be getting to the point where the requests library is common enough to be a candidate for the standard library.

There was some reorganization for Python 3:

https://jeremyhylton.blogspot.com/2008/06/

I think there's quite a lot of use of requests that would be fine with 'urllib.request.urlopen(...)'.

This might be true; I think the client code in the Python stdlib is much closer to production usable than the server code.
Disagree on typing. Modern types, as evidenced by typescript, are very helpful and don’t incur significant verbosity cost. They are expensive in large projects during linting.

My personal recommendation is to use typing and mypy in all new code, coming from somebody who was celebrating new-style classes in 2.2.

IMO Python typing really became good with the advent of Microsoft's type checker in VSCode, and probably PyCharm too, although I've never used it.

Typing with mypy during development never quite cut it because it's optional (unlike e.g. Typescript), and the editor support just didn't quite make it effortless the way VSCode/Pylance did. (I'm talking about development, not CI.)

> The type annotations never took off

I don’t think that’s true; I think that type annotations have been seeing significant gains in usage in Python in recent years.

Have they? Genuinely asking. The recent code samples I did see on SO don’t yet include them and the one big Python project (Django) that I use hasn’t started making use of then just yet, or at least not to my knowledge.
IME they are increasingly used by application developers but a lot of libraries and even Python's own documentation have not really embraced them yet. That makes using them a lot harder - and sometimes less useful - than in comparable languages like TypeScript. Every client we've worked with recently who uses Python was at least trying to use type annotations but not necessarily with the same level of commitment or expected ROI.