Raising an exception is already costly, but unlike exceptions like StopIteration and KeyError, NameError is not often expected and caught. If your buggy program takes 20ms to fail and raise instead of 15ms, is anyone going to care?
(Ironically, I do catch NameError, usually for feature detection, especially in older code that had to run under both Python 2 and 3. But that’s just a one-off cost when the module loads so I don’t think it will affect me too much.)
I don’t think the extra cost will be prohibitive, but actually trying it and measuring the performance hit is the only way to be sure.
I think that extending suggestions to stdlib modules is a good idea, especially for students.
The main downside is that we all know what comes next:
“Why can’t the suggestion also check for third-party modules in the search path too?”
@rhettinger what do you think about this as an aid to students?