[Python-ideas] [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

Laura Creighton lac at openend.se
Sun Nov 1 07:20:43 EST 2015


In a message of Sun, 01 Nov 2015 22:42:50 +1100, "Steven D'Aprano" writes:
>On Sun, Nov 01, 2015 at 10:49:49AM +0100, Laura Creighton wrote:
>
>> Adding warnings to IDLE when you save a file is a fine idea, and will
>> help IDLE users avoid pain.
>
>IDLE users must be different from most computer users then, because most 
>computer users don't read warnings or errors.
>
>http://ignorethecode.net/blog/2008/10/31/nobody-reads/
>
>http://stackoverflow.com/questions/125269/how-would-you-handle-users-who-dont-read-dialog-boxes

This is actually my old field of research.

The reason that most users don't read dialog boxes is that they are using
operating systems who chat them up using dialog boxes all the time.
They are used to having a dialog box mean 'the computer is working
as usual'.  They do not associate this with warnings or errors.  Thus
they are oblivious to them.

This is the argument against running your C code with lint every single
time.  People get used to seeing:

__Warning: long assignment may lose accuracy__

treat it as noise, and then when you actually want them to find such errors
are unable to find them.  It's quite astonishing.  They can read the
lint output to you out loud, and _still_ not be able to do the exercise
where they were to find rounding errors in their programs.

However, when you divide people into groups and make one group use
lint all the time, and tell the others not to use it, until they
get to this question -- poof.  The second group finds the rounding
errors.

So if, unknownst to me, lots and lots of people are shadowing the
stdlib, then if we issue warnings we may blunt their ability to
see warnings in general.  And that would be a downside.  But the
upside is that all of the people who did this inadvertantly would
get a warning that actually explained what is going on.  And the other
thing that is well understood is that people who are learning tend
to see warnings and whatnot -- simply because they haven't had the
time and the experience to file the warnings as 'just more noise'.

>> I want to help _everybody_ with a change
>> to Python, so that it issues a warning when you shadow something in
>> the standard library.
>
>It's not enough to protect the stdlib. I've seen people accidently 
>shadow numpy, or other third-party modules.

Yes, but I very much don't want any warnings when you shadow third
party modules.  If shadowing third party modules produce a warning,
then we will end up with 'all warnings get ignored' in very short
order.

We want warnings to be rare, rare enough that people don't get used
to seeing them.  If you can point me at a large community of regular
intentional shadowers of the standard library, that quite likely would
be enough for me to think that warning people is a bad idea -- having 
people get into the habit of ignoring warnings is a really dreadful 
outcome.

But the argument isn't 'we shouldn't issue warnings because people
don't read them' but rather 'we shouldn't make warnings commonplace
because that makes people incapable of reading them'.

>-- 
>Steve

(This ignores a different group of learners who have been studied,
 people who cannot learn and read at the same time.  Only some of
 these people have the sorts of problems that get called dyslexia.
 But video tutorials are making life a lot easier for these people
 nowadays.  And it is hard to see how adding a warning could harm
 these learners.)

Laura


More information about the Python-ideas mailing list