Eric Snow <ericsnowcurren...@gmail.com> added the comment:

Wow!  I was literally working on this problem yesterday.  The abstract check is 
done at instantiation time (in object.__new__, typeobject.c).  So as it stands 
__new__ has no way to validate that all your abstract properties have been 
implemented unless they are actual properties.

The solution I found simplest is to not inherit from an ABC but rather to 
register your class to it, and make sure that you are compliant, whether 
through properties or instance names.

If there is a way to check the instance for names that "implement" abstract 
properties that would be a useful thing in my mind.  However, I am not sure 
this is doable without some serious work.  Yesterday I put together a list of 
some solutions that would mostly work that I plan on sending to python-list 
today.  I am not sure if baking that into the core of Python will work.

In my mind this is a question of if abstract methods (and thereby properties) 
are a promise that an instance complies with an interface or just that the 
class of the instance complies.

----------
nosy: +ericsnow

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

Reply via email to