dry-python / dry-python/returns

doc: example not using cls or self.__class__

Aperta
#1,216 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
4.4k
Fork
155
Merge medio
2h 27m
PR unite (30g)
22

Descrizione

(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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.