[Python-ideas] Smart/Curly Quote Marks and cPython

Sven R. Kunze srkunze at mail.de
Sat Oct 22 12:12:26 EDT 2016


+1 from me for the idea of a more useful error message (if possible).


On 22.10.2016 09:36, Ryan Birmingham wrote:
> Per the comments in this thread, I believe that a better error message
> for this case would be a reasonable way to fix the use case around this
> issue.
> It can be difficult to notice that your quotes are curved if you don't
> know that's what you're looking for.
>
> -Ryan Birmingham
>
> On 22 October 2016 at 03:16, Steven D'Aprano <steve at pearwood.info
> <mailto:steve at pearwood.info>> wrote:
>
>     On Sat, Oct 22, 2016 at 06:13:35AM +0000, Jonathan Goble wrote:
>     > Interesting idea. +1 from me; probably can be as simple as just having the
>     > tokenizer interpret curly quotes as the ASCII (straight) version of itself
>     > (in other words, " and the two curly versions of that would all produce the
>     > same token, and same for single quotes, eliminating any need for additional
>     > changes further down the chain).
>
>     There's a lot more than two. At least nineteen (including the ASCII
>     ones): 〝〞〟"'"'«»‘’‚‛“”„‟‹›
>
>
>     > This would help with copying and pasting
>     > code snippets from a source that may have auto-formatted the quotes without
>     > the original author realizing it.
>
>     Personally, I think that we should not encourage programmers to take a
>     lazy, slap-dash attitude to coding. Precision is important to
>     programmers, and there is no limit to how imprecise users can be. Should
>     we also guard against people accidentally using prime marks or ornaments
>     (dingbats):
>
>     ′″‴‵‶‷ ❛❜❝❞❮❯
>
>     as well? If not, what makes them different from other accidents of
>     careless programmers?
>
>     I don't think we should be trying to guess what programmers mean, nor do
>     I think that we should be encouraging programmers to use word processors
>     for coding. Use the right tool for the right job, and even Notepad is
>     better for the occasional programmer than Microsoft Office or
>     LibreOffice. Programming is hard, requiring precision and care, and we
>     don't do beginners any favours by making it easy for them to be
>     imprecise and careless.
>
>     I would be happy to see improved error messages for smart quotes:
>
>     py> s = ‘abcd’
>       File "<stdin>", line 1
>         s = ‘abcd’
>                  ^
>     SyntaxError: invalid character in identifier
>
>     (especially in IDLE), but I'm very dubious about the idea of using
>     typographical quote marks for strings. At the very least, Python should
>     not lead the way here. Let some other language experiment with this
>     first, and see what happens. Python is a mature, established language,
>     not an experimental language.
>
>     Of course, there's nothing wrong with doing an experimental branch of
>     Python supporting this feature, to see what happens. But that doesn't
>     mean we should impose it as an official language rule.
>
>
>
>     --
>     Steve
>     _______________________________________________
>     Python-ideas mailing list
>     Python-ideas at python.org <mailto:Python-ideas at python.org>
>     https://mail.python.org/mailman/listinfo/python-ideas
>     <https://mail.python.org/mailman/listinfo/python-ideas>
>     Code of Conduct: http://python.org/psf/codeofconduct/
>     <http://python.org/psf/codeofconduct/>
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



More information about the Python-ideas mailing list