On 14 July 2015 at 22:06, Dima Tisnek <dim...@gmail.com> wrote:
> Thus the question, how far should Python go to detect possible
> erroneous user behaviour?
>
> Granted it is in tests only, but why not detect assrte, sasert, saster
> and assrat?

Because "r" and "e" are right next to each other on a QWERTY keyboard
(so it's an easy typo to make), and transposing them doesn't change
the overall shape of the word (so it's a hard typo to detect).

If you get the "a" or "t" out of position you change the shape of the
word so typos involving those are easier to detect visually, while "s"
and "e" are on different keyboard rows so typos at that point in the
word are less likely in the first place.

Drawing the line at only rejecting "assert_" *would* have been a
reasonable alternative design choice, but it isn't the one Kushal and
Michael made, and there isn't a compelling argument in favour of
changing the implementation of the new guard to allow the typo'ed
prefix.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to