On 30 November 2016 at 02:14, Stephen J. Turnbull
> How about:
> class Blog:
> blog = get_blog_for_date(someday)
> logn = log(blog.size)
> NameError: Python doesn't recognize the function "log". Did you
> mean "Blog"?
> NameError: Python doesn't recognize the name "log". Perhaps
> you need to import the "math" module?
... and of course up until this example, I'd assumed you were talking
about the log function from the logging module :-)
I'm a strong +1 on better error messages, but there's always a risk
with heuristics that the resulting messages end up worse, not better.
Maybe keep it simpler:
NameError: Python doesn't recognize the name "log". Maybe you
misspelled the name, or did you mean to import the function from a
and don't try to guess the user's intent.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/