From c92d5be284b01466df90b9327804018d9f0cfedd Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Tue, 5 Nov 2024 14:17:28 +0100 Subject: [PATCH] Add comment --- api/cd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/cd.py b/api/cd.py index 1a79675..3e8a78e 100644 --- a/api/cd.py +++ b/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 }