Commits

masklinn committed c71fb2b

Document Base.add_filter (outside the readme)

  • Participants
  • Parent commits 0f05700

Comments (0)

Files changed (1)

             MetaBase(cls.__name__, tuple(extenders), {}))
     @classmethod
     def add_filter(cls, callable):
+        """Adds the predicate as an extension filter to the current
+        class (and its children): only extension classes matching the
+        predicate (for which the predicate returns anything other than
+        the literal ``False``) will be used to actually extend the classes.
+
+        :param callable: A function returning whether the provided
+                         candidate ``extends.Extend`` can be used to
+                         extend the current class (or any of its
+                         subclasses). Has to return ``False`` (exactly)
+                         to forbid an extension.
+        :type callable: (cls<extends Base>, candidate<extends Extend>) -> bool
+        """
         cls._extension_filters.append(callable)
     @classmethod
     def _accepts(cls, candidate):