A third-party module on PyPI for "fix-the-horrible-things-Outlook-does" could be useful.  There is no way the standard library can or should keep up with the newest mangling techniques mail handlers employ in this week's version.

I don't understand what you mean by the current interpreter not telling you which character is bad.  It puts a pointer right under the problem character in the error message.  Nothing is being hidden, even if the code-manglers can do pretty insidious things... different in every version, for every sender, and for every recipient.

On Mon, May 11, 2020 at 3:24 AM Steve Barnes <GadgetSteve@live.co.uk> wrote:


-----Original Message-----
From: Steven D'Aprano <steve@pearwood.info>
Sent: 11 May 2020 06:02
To: python-ideas@python.org
Subject: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens

On Mon, May 11, 2020 at 04:28:38AM +0000, Steve Barnes wrote:

> So we currently have a situation where not only does whether code
> works or not depends on who typed it, in what environment, with what
> settings but also on the same factors for who received it

You say "currently", but that has always been the case, and the further back you go, the worse it was.
[Steve Barnes] True - apart from the older email clients being less "helpful".

> - so I could
> use Outlook or Word to send a code fragment to 100 people and 5 say
> that is great it works and the other 95 end up thinking that there is
> something wrong with their installation.

While the actual problem is that you are sending code via a non-WYSIWYG
medium that may modify what you type.

If you want to send code via email, the most reliable method is to
attach it as a .py file.

[Steve Barnes] My employer mandates the communication method(s) (as do many others). They also block unsafe "attachments" such as .py & .bat files (even when zipped). In any case I am often trying to tell the end user how to invoke existing code that they already have from the command line, (especially when they have stored files in folders with spaces, ampersands, hyphens, etc., in the path).

> Personally I don't think this
> fits in with the pythonic way of thinking!

The Zen says differently:

"Errors should never pass silently."

It's not Python's responsibility to make up for lossy transmission
methods such as mail servers which strip the high bit off every octet,
or faulty hardware that randomly corrupts one byte in a thousand.

And nor is it the interpreter's responsibility to guess what the user
intended to type, or *should have* intended to type, in the face of
editors which substitute characters.

[Steve Barnes] What I would prefer is an error message that actually tells the end user which specific character(s) they have got wrong rather than something is wrong after all "Explicit is better than implicit" would suggest that "illegal character x (Unicode u)" would be more pythonic than the current error message.
--
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/3AO3MPWD7YRCQSHU5UIUSDENCO526PTD/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/UC6YNOSVVIDCQDMB5T73RIJALPUVPDLZ/
Code of Conduct: http://python.org/psf/codeofconduct/


--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.