Closed
Description
Feature or enhancement
Make both AttributeErrors the same.
I'm not 100% sure whether this is a bug report or a feature request.
Pitch
For the next example classes, the behavior of X().slot
is slightly different :
class A:
pass
class B:
__slots__ = "slot"
class C:
__slots__ = ()
A().slot
and C().slot
will raise AttributeError: 'A' object has no attribute 'slot'
.
However, B().slot
will raise AttributeError: slot
.
The supplementary information (although limited) from the first message should be included in the second one as well. And I think it's a mistake to make a slotted missing attribute and an unslotted one behave differently, for arguable visibility reasons.