Eric V. Smith <e...@trueblade.com> added the comment:

Also, the dot after the first 'b' was confusing to me: I thought it had 
something to do with an attribute of b. And the quotes around the second 'b' 
were also confusing, but that's mostly because the original example initialized 
a class variable named 'b' with the str value 'b'.

Maybe a better error would use a colon:

AttributeError: foo: Did you mean: 'foo1'?

Looking at 3.10s behavior, I can't decide what logic it's using to suggest 
something:

>>> 'foo'.formatx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'formatx'. Did you mean: 'format'?
>>> class C: pass
...
>>> C().a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'C' object has no attribute 'a'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44655>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to