[issue35836] ZeroDivisionError class should have a __name__ attr

2019-01-27 Thread jcrmatos
jcrmatos added the comment: Hello, You are correct. My bad. Thanks, JM -- ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue35836] ZeroDivisionError class should have a __name__ attr

2019-01-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: You are not looking at the class, you are looking at an instance: py> exc = ZeroDivisionError('divide by zero') py> type(exc).__name__ 'ZeroDivisionError' py> exc.__name__ Traceback (most recent call last): File "", line 1, in AttributeError: 'ZeroDivision

[issue35836] ZeroDivisionError class should have a __name__ attr

2019-01-27 Thread jcrmatos
New submission from jcrmatos : Hello, When trying this try: 1/0 except Exception as exc: print(type(exc)) # returns print(exc.__name__) # returns AttributeError: 'ZeroDivisionError' object has no attribute '__name__' I believe all classes should have a __name__ attr, correct?