curved-television-6568
11/24/2021, 2:11 PMOverridesField
meant to always be subclassed?curved-television-6568
11/24/2021, 2:12 PM$ ./pants help
15:12:04.38 [ERROR] type object 'OverridesField' has no attribute 'help'
curved-television-6568
11/24/2021, 2:12 PMcurved-television-6568
11/24/2021, 2:18 PMhundreds-father-404
11/24/2021, 2:33 PMcurved-television-6568
11/24/2021, 2:42 PMfast-nail-55400
11/24/2021, 3:18 PMcurved-television-6568
11/24/2021, 3:22 PMhelp
could be annotated such, that it would err if not present, for instance.fast-nail-55400
11/24/2021, 3:28 PMfast-nail-55400
11/24/2021, 3:30 PMfast-nail-55400
11/24/2021, 3:31 PM@abstractmethod
, the check doesn’t happen until runtimecurved-television-6568
11/24/2021, 3:35 PMcurved-television-6568
11/24/2021, 3:36 PMalthough, the way that the mypy docs describe usingYeah, the reason for it being, that a class is deemed abstract if you don’t implement one of the inherited abstract methods, so it’s not an error until you instantiate it (but that’s not restricted to runtime, right?), the check doesn’t happen until runtime@abstractmethod
fast-nail-55400
11/24/2021, 3:39 PMmypy
should be able to know that the derived type is actually abstract and see that it is being instantiated and should error. Static type information should allow it to make that determination.fast-nail-55400
11/24/2021, 3:41 PMfast-nail-55400
11/24/2021, 3:41 PMcurved-television-6568
11/24/2021, 3:41 PMcurved-television-6568
11/24/2021, 3:42 PMy: ClassVar[T]
should be enough, as soon as you instantiate a class, y
should be defined with a value of type T
, or err out.fast-nail-55400
11/24/2021, 3:45 PMClassVar
as abstract :(curved-television-6568
11/24/2021, 5:23 PMcurved-television-6568
11/28/2021, 9:03 PM