Hacker News new | ask | show | jobs
by bscphil 2390 days ago
One of the typical arguments in favor of small base languages is that frequently the best package will be written by a third party and become the "default", making the language bloated. For example, everyone uses Requests in Python instead of the built-in alternative. On the other hand, I think a big advantage of batteries-included languages that they define a standard implementation that other libraries can copy. Because there's an official JSON package for Go, everyone already knows how to use this new one, since it's a drop-in replacement. Obviously this won't happen in all cases, but when it does it feels really nice.
2 comments

> everyone uses Requests in Python

I love Requests, but this statement overreaches. All of my Python these days is simple scripting, and in those simple cases the hassle of adding a dependency outweighs the utility that Requests provides over the standard library. And I'd say Requests is even a special case here in that it's widely known and acknowledged; while I wager you can find superior third-party replacements to the Python standard library if you look for them, the fact that you don't need to look for them at all (and audit them, ideally!) is what makes a batteries-included language so convenient even in the presence of a sub-par stdlib.

yup, I've used stdlib urlopen in an assortment of scripts, it works, even with python2/python3 cross compatibility:

    if sys.version_info[0] == 2:
        from urllib2 import urlopen, Request  # python2
    else:
        from urllib.request import urlopen, Request  # python3
Another good example is the python stdlib package json: ujson and cjson are drop in replacements that use c bindings to achieve much better performance. However, json is still very useful if you only need to parse/dump a reasonably small amount of data and don't want your users to need to build the c bindings.