[Python-ideas] abc.optionalabstractmethod
James William Pye
x at jwp.io
Tue Aug 7 12:44:57 CEST 2012
On Aug 7, 2012, at 12:42 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> However, the long "implements" lists that Java is prone to is
> precisely the boilerplate I consider unacceptable (and antithetical to
> ducktyping).
*shrug*
I figure if you run into a case where you see a long combination in common use, go
ahead and make another ABC consisting of that combination.
Or just throw them in a sequence and map a methodcaller.
> there really isn't an obvious
> general purpose mechanism that easily lets you document the existence
> of an optional method in an ABC
ISTM the proposed mechanism is a bit of a contradiction, and the value provided
to documentation extractors does not appear to be particularly significant.
However, annotations on the implementation may be a reasonable solution for
documentation extractors:
def foo() -> NotImplemented:
...
> That's why the IO stack has methods like "seekable()" - to ask the
> question "is the seek() method implemented?".
Well, hopefully for ESPIPE…Which doesn't appear to be the case.. =(
More information about the Python-ideas
mailing list