Typing on child class' methods of a Generic base class

2022-03-09 Thread Nicolas Haller
ate_method(self, an_arg: T) -> T: # I keep T return 42 class Alternative2(Base[int]): def _private_method(self, an_arg: int) -> int: # I replace T return 42 Thanks, -- Nicolas Haller [1]: https://docs.python.org/3/library/typing.html#user-defined-generic-types -- https://mail.python.org/mailman/listinfo/python-list

Re: Typing on child class' methods of a Generic base class

2022-03-12 Thread Nicolas Haller
On 2022-03-10 12:31, Dieter Maurer wrote: Nicolas Haller wrote at 2022-3-9 10:53 -0500: ... The documentation about "user-defined generic types"[1] says that I can fix some types on a child class (class MyDict(Mapping[str, T]):) but doesn't say much about the signature of the me