from dataclasses import dataclass @dataclass class F: i : int f : float def m(self, other : int) -> float: assert other != 1000, "oh no!" return self.f + float(other) f = F(f=3.1, i=10) a = 3 res = [float(x) for x in range(4) if x % 2 == 0] for i in range(10): res.append(float(a * 3) ** float(i)) res.append(f.m(i)) print(res) assert len(res) > 0 and not 12345.6 in res from enum import Enum class EFoo(Enum): A = 1 B = 2 a_inst = EFoo.A