[Python-Dev] How far to go with user-friendliness

Steven D'Aprano steve at pearwood.info
Tue Jul 14 15:41:56 CEST 2015

On Tue, Jul 14, 2015 at 02:06:14PM +0200, Dima Tisnek wrote:
> https://bugs.python.org/issue21238 introduces detection of
> missing/misspelt mock.assert_xxx() calls on getattr level in Python
> 3.5
> Michael and Kushal are of the opinion that "assret" is a common typo
> of "assert" and should be supported in a sense that it also triggers
> AttributeError and is not silently ignored like a mocked user
> attribute.
> I disagree

I must admit I don't use mock so don't quite understand what is going on 
in this bug report. But I don't imagine that anything good will come out 
of treating *one* typo differently from all the other possible typos. 
Why should "assret" be treated differently from other easy-to-make typos 
like "asert", "assrt", "asset"? Or "assort", which is not only a 
standard and common English word, but "e" and "o" are right next to each 
other on Dvorak keyboards, making it an easy typo to make.

Surely this is an obvious case where the Zen should apply. "Special 
cases aren't special enough..." -- either all such typos raise 
AttributeError, or they are all silent.


More information about the Python-Dev mailing list