Browse Source

Add comment

Joeri Exelmans 9 months ago
parent
commit
c92d5be284
1 changed files with 2 additions and 1 deletions
  1. 2 1
      api/cd.py

+ 2 - 1
api/cd.py

@@ -44,7 +44,8 @@ class CDAPI:
             # includes the type itself - reason: if we want to check if something is an instance of a type, we check if its type or one of its super types is equal to the type we're looking for, without having to consider the instance's type itself as an extra case
             return [type_name, *(super_type for parent_name in self.direct_super_types.get(type_name, set()) for super_type in get_transitive_super_types(parent_name))]
 
-
+        # The transitive sub-/super-types of every type includes the type itself.
+        # This is because, often we want to know if an instance's type is 'compatible' (substitutible) with a specified type.
         self.transitive_sub_types = { type_name: set(get_transitive_sub_types(type_name)) for type_name in self.direct_sub_types } 
         self.transitive_super_types = { type_name: set(get_transitive_super_types(type_name)) for type_name in self.direct_super_types }