Namespaces: memory vs 'pollution'
Ethan Furman
ethan at stoneleaf.us
Tue Jul 23 10:46:19 EDT 2019
On 07/22/2019 07:27 PM, DL Neil wrote:
> NameError conveys nothing to the user.
> PythonVersionError is more communicative - and speaks volumes to 'us'.
>
> The mainline code is something like:
>
> p = PythonEnvironment()
> try:
> p.compatibility( ...spec... ) # eg must be Py3 not 2.n
> except PythonVersionError:
> print( more illuminating errmsg )
This is why tests should check for the exact error raised, not that any error was raised. (That testing bug bit me a couple times before I learned that lesson.)
--
~Ethan~
More information about the Python-list
mailing list