From 9fc14bafe7ee0e48ac2a043b2fd6926cddb6f018 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Sun, 19 Mar 2023 18:35:24 +0100 Subject: [PATCH] Drop large disclaimer, thanks to generic reimplementation --- src/eko/quantities/__init__.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/eko/quantities/__init__.py b/src/eko/quantities/__init__.py index 9743f5f84..3193b125b 100644 --- a/src/eko/quantities/__init__.py +++ b/src/eko/quantities/__init__.py @@ -5,29 +5,4 @@ Few related functions are also defined here. -Note ----- -Unfortunately, Python has still some discrepancies between runtime classes and -type hints, so it is better not to mix dataclasses and generics. - -E.g. before it was implemented:: - - @dataclasses.dataclass - class RunningReference(DictLike, Generic[Quantity]): - value: Quantity - scale: float - -but in this way it is not possible to determine that ``RunningReference`` is -subclassing ``DictLike``, indeed:: - - inspect.isclass(RunningReference) # False - issubclass(RunningReference, DictLike) # raise an error, since - # RunningReference is not a class - -Essentially classes can be used for type hints, but types are not all classes, -especially when they involve generics. - -For this reason I prefer the less elegant dynamic generation, that seems to -preserve type hints. - """