If we’re back to considering e.g. “```toml” as a marker, one idea not yet covered in the “Rejected Ideas” section is putting it in the docstring.
This would avoid having to deal with #
(or #
, or #\s*
…), which is another stumbling block for syntax highlighting and maintaining user formatting. The regex-approach would of course still work with that marker.
Though to be honest, I don’t see the problem with backslashes (and staying with __pyproject__
). When we’re talking about runtime, we’re talking (presumably) about where we’re executing the regex-pattern. Once we have the output of that regex, it’d be trivial to post-process that (by turning \
into \\
[1]) before actually evaluating the string in toml.loads
.
Then it would make sense to keep disallowing raw strings (also f-strings, BTW), and it’d be a clear case of saying that __pyproject__
is always treated 1:1 as toml.
with some exceptions (e.g. linebreaks:
\n
,\r
) ↩︎