[New-bugs-announce] [issue38530] Offer suggestions on AttributeError

Pablo Galindo Salgado report at bugs.python.org
Sat Oct 19 14:57:31 EDT 2019


New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:

To improve the debugging experience in both interactive and non-interactive code, I propose to offer suggestions when attribute access fails. For example:

>>> class A: foo = None
... 
>>> A.fou
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'A' has no attribute 'fou'

Did you mean: foo?

This also applies to imports from modules and other situations:

>>> import collections
>>> collections.NamedTuple
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'NamedTuple'

Did you mean: namedtuple?

----------
components: Interpreter Core
messages: 354954
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Offer suggestions on AttributeError
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38530>
_______________________________________


More information about the New-bugs-announce mailing list