[New-bugs-announce] [issue35836] ZeroDivisionError class should have a __name__ attr

jcrmatos report at bugs.python.org
Sun Jan 27 05:24:57 EST 2019


New submission from jcrmatos <jcrmatos at gmail.com>:

Hello,

When trying this
try:
    1/0
except Exception as exc:
    print(type(exc))  # returns <class 'ZeroDivisionError'>
    print(exc.__name__)  # returns AttributeError: 'ZeroDivisionError' object has no attribute '__name__'

I believe all classes should have a __name__ attr, correct?

It would be nice to check all the other exceptions to see if any other is also missing the __name__ attr.

Thanks,

JM

----------
messages: 334416
nosy: jcrmatos
priority: normal
severity: normal
status: open
title: ZeroDivisionError class should have a __name__ attr
versions: Python 3.7

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


More information about the New-bugs-announce mailing list