Hacker News new | past | comments | ask | show | jobs | submit login

Amen. Much as I wish python importing was as powerful as js, that ship has sailed and we're nowhere close to getting rid of the dunder-init file.

Also pathlib is .. urgh. This is one of those that shouldn't be in the stdlib. I don't get why it is, but requests isn't.




> Much as I wish python importing was as powerful as js

In what way is python importing less powerful than JS? My experience is very much the opposite (to the extent that JS even has an import system).

> I don't get why it is, but requests isn't.

Because pathlib was proposed (PEP 428), considered useful and self-contained.

The requests project does not want it to be included (this was discussed at length back in 2015), and it would require merging chardet and urllib3 into the stdlib first.


My post was unclear, it's fair that base JS doesn't have an import system; I was talking about ES6 imports.

And yes I'm aware why requests isn't in the stdlib, but that doesn't make it "correct". And chardet should definitely be in the stdlib. I mean, ffs, `mimetypes` is in the stdlib. urllib3 is more contentious but honestly? It probably should be as well.


Js has no import system. Bundlers do, and they are terrible at it though.



Which don't work in the browser, the main place we use JS.


It does work in all modern browsers except Edge. Which I grant you might be a sticking point. However, Edge is moving to Chromium in the near future.


Firefox 66:

import('/modules/mon-module.js') SyntaxError: dynamic module import is not implemented

So no network access, and of course no FS access.

Hence, doesn't work in the browser. You need a lib or a bundler.


I'm also using Firefox 66 and it works for me. Here's a live example: https://mdn.github.io/js-examples/modules/basic-modules/

Source code and other examples are at: https://github.com/mdn/js-examples/tree/master/modules


We already have SQLite, difflib, et al. What's so bad about pathlib? I use it all the time, it's great.


What's your deal with pathlib?


For starters, I'd say that overloading the multiplication operator to concatenate strings and insert path separators is one very bad code smell.


pathlib is nice




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: