Nick Coghlan <ncogh...@gmail.com> added the comment:

Remember the goal here is *not* to completely eliminate the need to test that 
objects implement an ABC correctly. It's to make it easier to declare the 
expected interface in a way that helps readers of the ABC definition to figure 
out what is going on, and to reduce the proliferation of abstract descriptors.

Since we made a deliberate choice not to do signature checks when ABCs were 
added to the language, there's nothing an ABC can do to stop someone (for 
example) overriding an abstract method or descriptor "foo" with "foo = 1". 
That's almost certainly wrong, but it's wrong at a level that ABCs don't care 
about.

If someone incorrectly overrides a read/write property with a read-only 
property and there's nothing in their test suite that picks that up, then 
that's a flaw in the test suite, not a flaw in the ABC itself.

Regarding the naming, @abstractmethod and __isabstractmethod__ are definitely 
about methods, or method-based descriptors (such as property). There *could* be 
a case to be made to allow for abstract data attributes, but really, using an 
abstract property should cover that use case well enough.

----------

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

Reply via email to