[Python-ideas] Smart/Curly Quote Marks and cPython
Stephen J. Turnbull
turnbull.stephen.fw at u.tsukuba.ac.jp
Mon Oct 24 22:00:30 EDT 2016
Chris Barker writes:
> I think the "better error message" option is the way to go,
> however. At least until we all have better Unicode support in all
> our tools....
I don't think "better Unicode support" helps with confusables in
programming languages that value TOOWTDI. OK, we already have 4 kinds
of quoting in Python which suggests that TOOWTDI doesn't apply to
quoting, but I think that's a bit naive. Given the frequency with
which quotes appear in strings, and the fact that English quotation
marks can't nest but rarely need to nest more than once, use of both
"" and '' with identical semantics to make one level of nesting
convenient and readable was plausible. The use of triple quotes for
block quoting again has arguments for it. You can think that these
were experiments with "meh" results[1], but I don't think it's
appropriate to say that therefore TOOWTDI doesn't apply to quote
marks.
As a general rule, I think use of confusables in new syntax (eg,
double curly quotes = f"") runs into "Syntax shall not look like grit
on Tim's screen". OTOH, better Unicode support should (cautiously)
be used to support new operators and syntax subject to TOOWDTI and
other considerations of Pythonicity.
Footnotes:
[1] Personally, I immediately liked the triple quotes, because the
(Emacs) Lisp convention of allowing literal newline characters in all
strings caused a number of small annoyances. I also quickly evolved a
personal convention where single quotes indicate "string as protocol
constant" (eg, where today we'd use enums), while double quotes
indicate "arbitrary text content". But those are both obviously YMMV
evaluations.
More information about the Python-ideas
mailing list