dry-python/returns

doc: example not using cls or self.__class__

majidaldo opened this issue · 1 comments

(sorry this is just a question...not a bug. didn't know where to go just for a question. maybe open a github discussion?)

in the example,

...
..     @classmethod
...     def from_value(  # This method is required by Applicative
...         cls,
...         inner_value: _NewNumberType,
...     ) -> 'Number[_NewNumberType]':
...         return Number(inner_value)

why not use cls(inner_value)? also, i understand Applicative is a protocol/interface. but it's so generic. why not make it a mixin?

@majidaldo you can try! I had problems with mypy, it was not understanding some parts of this definition.

PR is welcome 🙂