Hacker News new | ask | show | jobs
by noirscape 1042 days ago
One thing I don't quite get is why the proposal here is so insistent on triple quoted strings only. Shouldn't a \n formatted string also be considered valid? Its practically just a string after all.

Other than that, this isn't a bad proposal. Generally for single-file scripts, figuring out the imports isn't too difficult but you do have the occasionally weirdly named pypi package vs installed import package.

2 comments

I think the reason for being so specific about using tripple quoted strings is that this stuff needs to be parsed out without running it through the interpreter. e.g. pip needs to be able to fish out the pyproject.toml data to install dependencies before running the script is even going to work.

It's just lightening the load on developers by making the parsing simpler.

The syntax is restricted so the toml content can be extracted without actually parsing the Python file, a regex is enough.