As this is a third party package, you, of course, can do what you want :-),
But I would likew to see more communicative error messages in standard
Python as well, and I think your package could be a great prototype --
thanks!
On Thu, Aug 6, 2020 at 2:57 AM André Roberge
wrote:
3. It allows one to
On Thu, Aug 6, 2020 at 3:40 AM Christopher Barker
wrote:
> I'm all for clear and helpful error messages, but this feels a tad too
> verbose (and even a bit patronizing) to me. But the highlighting of
> character look-alikes is very helpful.
>
> Perhaps something like:
>
> """
> SyntaxError: inval
I'm all for clear and helpful error messages, but this feels a tad too
verbose (and even a bit patronizing) to me. But the highlighting of
character look-alikes is very helpful.
Perhaps something like:
"""
SyntaxError: invalid character in identifier
-->2: print(“Squares:”)
Like it!
Sent from Samsung Mobile on O2
Get Outlook for Android<https://aka.ms/ghei36>
From: André Roberge
Sent: Wednesday, August 5, 2020 7:54:06 PM
To: Steve Barnes
Cc: python-ideas@python.org
Subject: Re: [Python-ideas] Re: Improve handling of Unicode
Reviving (briefly an old thread)
On Mon, May 11, 2020 at 2:13 AM Steve Barnes 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
On May 14, 2020, at 20:01, Stephen J. Turnbull
wrote:
>
> Executive summary:
>
> AFAICT, my guess at what's going on in the C tokenizer was exactly
> right. It greedily consumes as many non-operator, non-whitespace
> characters as possible, then validates.
Well, it like like it’s not quite
Executive summary:
AFAICT, my guess at what's going on in the C tokenizer was exactly
right. It greedily consumes as many non-operator, non-whitespace
characters as possible, then validates. It does this because it is
tokenizing a stream of bytes encoding characters as UTF-8.
Andrew Barnert via
On May 13, 2020, at 05:31, Richard Damon wrote:
>
> On 5/13/20 2:22 AM, Stephen J. Turnbull wrote:
>> MRAB writes:
>>>
>>> This isn't a parsing problem as such. I am not an expert on the
>>> parser, but what's going is something like this: the parser
>>> (tokenizer) sees the character "=" and
Wow - a lot going on this thread -
despite what to do seemingly really obvious:
of course showing which character triggered the error
along with a proper plain English phrase is enough.
The Fortran anecdote in the beginning of the thread is a
false analogy, since the program _will_ _not_ run with
On 5/13/20 2:22 AM, Stephen J. Turnbull wrote:
> MRAB writes:
> > On 2020-05-11 09:21, Chris Angelico wrote:
> > > On Mon, May 11, 2020 at 6:09 PM Steve Barnes
> wrote:
>
> > >> Actually, in the case of the “wrong quotes” it puts the pointer
> > >> under the character before the space charact
MRAB writes:
> On 2020-05-11 09:21, Chris Angelico wrote:
> > On Mon, May 11, 2020 at 6:09 PM Steve Barnes
> > wrote:
> >> Actually, in the case of the “wrong quotes” it puts the pointer
> >> under the character before the space character or at the end of
> >> the line (if you have a fixed
On 2020-05-11 09:21, Chris Angelico wrote:
On Mon, May 11, 2020 at 6:09 PM Steve Barnes wrote:
Actually, in the case of the “wrong quotes” it puts the pointer under the
character before the space character or at the end of the line (if you have a
fixed spacing font – worse if you don’t) – it
11.05.20 03:34, Steven D'Aprano пише:
There are a couple of professionally published Python books written
using Restructed Text, Sphinx and Python. So people do have a choice,
or at least a technical choice.
There was similar issue with Sphinx. It uses a third-party tools to
"improve" the HTML
10.05.20 10:09, Steve Barnes пише:
4. Start accepting hyphens as minus & Unicode quotation marks – this
would be the ideal answer for pasted code but has a lot of possible
things to iron out such as do we require that the quotes match and
are in the typographically correct order. It
On Mon, May 11, 2020 at 6:09 PM Steve Barnes wrote:
>
> Actually, in the case of the “wrong quotes” it puts the pointer under the
> character before the space character or at the end of the line (if you have a
> fixed spacing font – worse if you don’t) – it still doesn’t tell you which
> charac
From: David Mertz
Sent: 11 May 2020 08:34
To: Steve Barnes
Cc: python-ideas@python.org
Subject: Re: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens
A third-party module on PyPI for "fix-the-horrible-things-Outlook-does" could
be useful. There is no way the standa
11, 2020 at 3:24 AM Steve Barnes wrote:
>
>
> -Original Message-
> From: Steven D'Aprano
> 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:3
-Original Message-
From: Steven D'Aprano
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 +, Steve Barnes wrote:
> So we currently have a situation where
trademark ™ \u2122
5. Some fractions e.g. ½ ¼
6. Non-breaking spaces
From: David Mertz
Sent: 10 May 2020 18:33
To: Steven D'Aprano
Cc: python-ideas
Subject: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens
On Sun, May 10, 2020 at 4:03 AM Steven D'Aprano
mail
On Mon, May 11, 2020 at 04:28:38AM +, 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
Andrew,
I already have a module that I include in a couple of widely used utilities at
work that I called cmd_line_fixup (but I think that I like defancier better) it
is used on the command line options prior to processing to fix several of
these issues. This was written in response to the fr
On Mon, May 11, 2020 at 2:29 PM Steve Barnes wrote:
>
>
>
> So I thought that Steve made the opposite mistake, accidentally using regular
> ASCII quotes when he intended to use Unicode quotes. But it turns out that
> Steve's mail client sends emails with a HTML part and a plain text part, and
>
So I thought that Steve made the opposite mistake, accidentally using regular
ASCII quotes when he intended to use Unicode quotes. But it turns out that
Steve's mail client sends emails with a HTML part and a plain text part, and
the plain text part substitutes the ASCII quotes for smart quot
On Sun, May 10, 2020 at 02:13:37PM -0400, Richard Damon wrote:
> A lot of this reminds me of a story told by a programming instructor in
> the 70's, he submitted a FORTRAN program deck to the machine, the
> complier gave him a warning on a statement which read INTEGER
> misspelled, it than ran the
On Sun, May 10, 2020 at 9:05 PM Steven D'Aprano wrote:
> On Sun, May 10, 2020 at 01:17:17PM -0700, Andrew Barnert via Python-ideas
> wrote:
> > (By the way, the reason I used -f rather than —fix is that I can’t
> > figure out how to get the iPhone Mail.app to not replace double
> > hyphens with a
On Sun, May 10, 2020 at 01:17:17PM -0700, Andrew Barnert via Python-ideas wrote:
> (By the way, the reason I used -f rather than —fix is that I can’t
> figure out how to get the iPhone Mail.app to not replace double
> hyphens with an em-dash, or even how to fix it when it does. All of
> the oth
I think it is a bad idea to change the design of Python because some
college professor teaching intro to programming very poorly might require
inappropriate tooling.
On Sun, May 10, 2020, 8:39 PM Jonathan Goble wrote:
> On Sun, May 10, 2020 at 8:08 PM David Mertz wrote:
>
>> Why would you use
On Sun, May 10, 2020 at 12:57:11PM -0700, Andrew Barnert via Python-ideas wrote:
> Can the error message actually include the Unicode character itself?
I can think of cases where that could be confusing, or mess up the
display of the error message. E.g. if it were an invisible character, or
swa
On Sun, May 10, 2020 at 07:39:32PM -0400, Jonathan Goble wrote:
> Sometimes people are forced to use Word to type code. One example is
> creating user manuals.
MS Word is not the only word processor capable of creating user manuals.
The LibreOffice people, and others, would like a word :-)
If y
On Sun, May 10, 2020 at 8:08 PM David Mertz wrote:
> Why would you use Word? LaTeX exists, and will export to PDF. Heck, the
> PDF export from Jupyter is quite good (by way of LaTeX).
>
> On Sun, May 10, 2020, 7:40 PM Jonathan Goble <
> Several of the questions required us to write Bash scripts o
Why would you use Word? LaTeX exists, and will export to PDF. Heck, the PDF
export from Jupyter is quite good (by way of LaTeX).
On Sun, May 10, 2020, 7:40 PM Jonathan Goble <
Several of the questions required us to write Bash scripts or Python
functions, and we were required to write all of that
By the way, did anyone else notice the irony that's Steve's examples of
invalid code is actually perfectly valid? Copying and pasting into the
interpreter shows that they are valid strings.
On Sun, May 10, 2020 at 07:09:15AM +, Steve Barnes wrote:
> But the following all result in an error
On Sun, May 10, 2020 at 4:00 AM Steven D'Aprano wrote:
> On Sun, May 10, 2020 at 07:09:15AM +, Steve Barnes wrote about
> Unicode dashes and quotes sneaking into code:
>
> > 2. Tell all users that they need to use a "proper" editor or IDE -
> > This seems like adding an additional barrie
On Sun, May 10, 2020 at 7:34 PM Andrew Barnert via Python-ideas <
python-ideas@python.org> wrote:
> On May 10, 2020, at 14:33, Christopher Barker wrote:
> >
> > Having a "tabnanny-like" function / module in the stdlib would be nice,
> though I'd think a stand alone module in PyPi would be almost
On May 10, 2020, at 14:33, Christopher Barker wrote:
>
> Having a "tabnanny-like" function / module in the stdlib would be nice,
> though I'd think a stand alone module in PyPi would be almost as good, and a
> good way to see if it gains traction.
Good point.
Plus, it might well turn out that
I wonder if The Fuck could be customize to handle these improved error
messages envisioned: https://github.com/nvbn/thefuck
It's a lovely tool. I don't mind the minor profanity, but when I teach I
add an alias of 'fix' for students to see instead.
On Sun, May 10, 2020 at 5:34 PM Christopher Bar
On Sun, May 10, 2020 at 1:17 PM Andrew Barnert via Python-ideas <
python-ideas@python.org> wrote:
> (By the way, the reason I used -f rather than —fix is that I can’t figure
> out how to get the iPhone Mail.app to not replace double hyphens with an
> em-dash, or even how to fix it when it does. Al
On Sun, 10 May 2020 14:13:37 -0400
Richard Damon wrote:
> An error like character (whatever) is not a quote (or is not a minus
> sign) seems similar. It is one thing to not recognize a funny
> character in the language, but to actually parse it well enough to
> give a message that says in effect,
On May 10, 2020, at 00:11, Steve Barnes wrote:
>
> What can be done?
I think there’s another option (in addition to improving SyntaxError, not
instead of it):
Add a defancier module to the stdlib. It has functions that take some text and
turn smart quotes into plain ASCII quotes, dashes and m
On May 10, 2020, at 03:47, Ned Batchelder wrote:
>
> On 5/10/20 3:09 AM, Steve Barnes wrote:
>> Change the error message “SyntaxError: invalid character in identifier” to
>> include which character and it’s Unicode value so that it becomes
>> “SyntaxError: invalid character 0x201c “ in ident
On Sun, May 10, 2020 at 2:17 PM Richard Damon
wrote:
> An error like character (whatever) is not a quote (or is not a minus+0060
> sign) seems similar. It is one thing to not recognize a funny character
> in the language, but to actually parse it well enough to give a message
> that says in effec
A lot of this reminds me of a story told by a programming instructor in
the 70's, he submitted a FORTRAN program deck to the machine, the
complier gave him a warning on a statement which read INTEGER
misspelled, it than ran the program, but IGNORED the statement, even
though it clearly understood w
On Sun, May 10, 2020 at 4:03 AM Steven D'Aprano wrote:
> I think that David(?) may have a Vim or Emacs mode that allows him to
> use Unicode chars as syntax?
>
I use the vim-conceal plugin: https://github.com/khzaw/vim-conceal. I know
that something similar exists for Emacs, but don't remember
To reinforce what others have said a bit:
It is absolutely OK to expect people to write code with a code editor.
Period. And having more than the alread two quote characters would be a
mess.
But this IS an issue, not with people writing code with tools meant for
writing text, but by people copyin
On 5/10/20 3:09 AM, Steve Barnes wrote:
Change the error message “SyntaxError: invalid character in
identifier” to include which character and it’s Unicode value so that
it becomes “SyntaxError: invalid character 0x201c “ in identifier” –
this is almost certainly the easiest change and fits w
On Sun, May 10, 2020 at 07:09:15AM +, Steve Barnes wrote about
Unicode dashes and quotes sneaking into code:
> What can be done?
>
> 1. Persuade Microsoft, and others, to stop being so helpful by
> default - good luck with that!
No, I think that in the broader picture, they are doing
46 matches
Mail list logo