
On Sun, May 12, 2013 at 2:55 AM, MRAB <python@mrabarnett.plus.com> wrote:
Do you really need the "!"? String literals can already have a prefix, such as "r".
At compile time, the string literal could be preprocessed according to its prefix (some kind of import hook, working on the AST?). The current prefixes are "" (plain literal), "r", "b", "u", etc.
1. Short prefixes are inherently cryptic (especially single letter ones) 2. The existing prefixes control how the source code is converted to a string, they don't permit conversion to a completely different construct 3. Short prefixes are not extensible and rapidly run into namespacing issues As noted, I prefer not to solve this problem at all (and add a basic lint capability instead). However, if we do try to solve it, then I'd prefer a syntax that adds a general extensible capability rather than one that piles additional complications on the existing string prefix mess. If we support dedent, do we also support merging adjacent whitespace characters into a single string? Do we support splitting a string? Do we support upper case or lower case or taking its length? Two responses make sense to me: accept the status quo (perhaps with linter support), or design and champion a general compile time string processing capability (that doesn't rely on encoding tricks or a custom import hook). Expanding on the already cryptic string prefix system does *not* strike me as a reasonable idea at all. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia