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

inspect.getattr_static has the necessary logic to search for descriptors 
without invoking them.

However, it may be better to revert to the idea of pushing this functionality 
back onto the individual descriptors and have the problematic descriptors like 
property and staticmethod simply implement __isabstractmethod__ as a property.

property:
  @property
  def __isabstractmethod__(self):
    return (self.fget.__isabstractmethod__ or
            self.fset.__isabstractmethod__ or
            self.fdel.__isabstractmethod__)

staticmethod/classmethod:

  @property
  def __isabstractmethod__(self):
    return self.__func__.__isabstractmethod__

With this approach, the "one true way" to handle abstract descriptors would be 
to do:

  #instance method
  @abstractmethod
  def f(self):
    ...

  @property
  @abstractmethod
  def f(self):
    ...

  @classmethod
  @abstractmethod
  def f(self):
    ...

  @staticmethod
  @abstractmethod
  def f(self):
    ...

This wouldn't allow for the prettier error messages, but it's much cleaner than 
having ABCMeta trawling through class attribute dir() lists.

----------
nosy: +michael.foord

_______________________________________
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