On 30 November 2016 at 02:14, Stephen J. Turnbull <turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
How about:
class Blog: pass
blog = get_blog_for_date(someday)
logn = log(blog.size)
NameError: Python doesn't recognize the function "log". Did you mean "Blog"?
Wouldn't
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 module? and don't try to guess the user's intent. Paul