Like it!

Sent from Samsung Mobile on O2
Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: André Roberge <andre.robe...@gmail.com>
Sent: Wednesday, August 5, 2020 7:54:06 PM
To: Steve Barnes <gadgetst...@live.co.uk>
Cc: python-ideas@python.org <python-ideas@python.org>
Subject: Re: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens

Reviving (briefly an old thread)

On Mon, May 11, 2020 at 2:13 AM Steve Barnes 
<gadgetst...@live.co.uk<mailto:gadgetst...@live.co.uk>> wrote:

My personal experience of the most common problematic substitutions by tools 
such as Outlook, Word & some web tools:

  1.  Double Quotes \u201c & \u201d “”
  2.  Single Quotes \u2018 & \u2019 ‘’
  3.  The m-hyphen \2013 –
  4.  Copyright © \xa9 and others, Registered ® \xae and trademark ™ \u2122
  5.  Some fractions e.g.  ½ ¼
  6.  Non-breaking spaces



SNIP

As part of this discussion, it was suggested that it would be useful if some 
more useful messages could be given about the use of some unicode "fancy 
quotes". Just in case some people were considering "wasting" time on this:
= = = =
 $ python -m friendly_traceback scratch.py

    Python exception:
        SyntaxError: invalid character in identifier

    A SyntaxError occurs when Python cannot understand your code.

    Python could not understand the code in the file
    'scratch.py'
    beyond the location indicated below by --> and ^.

       1: def squares(n):
    -->2:   print(“Squares:”)
                         ^

    Likely cause based on the information given by Python:
        Did you use copy-paste?
        Python indicates that you used some unicode characters not allowed
        as part of a variable name; this includes many emojis.
        However, I suspect that you used a fancy unicode quotation mark
        instead of a normal single or double quote for a string.

= = =
This is just one of many cases now correctly identified by friendly-traceback.

André Roberge
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/TD3MPOUWSRO6O64BV6HJWY25E75FNNBS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to