dry-python / dry-python/returns

doc: example not using cls or self.__class__

Open
#1,216 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
4.4k
Forks
155
Avg merge
2h 27m
Merged PRs (30d)
22

Description

(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](https://returns.readthedocs.io/en/latest/pages/interfaces.html#applicative),
```
...
.. @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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.