Pylint false positives

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Aug 17 02:35:32 EDT 2018


On Fri, 17 Aug 2018 08:14:02 +0200, Frank Millman wrote:

> How would you extend it without a long chain of
>     if isinstance(v, str):
>       [perform checks for str]
>     elif isinstance(v, int)
>       [perform checks for int]
>     etc
>     etc
> 
> I find that using a separate method per subclass does exactly what I
> want, and that part of my project has been working stably for some time.

You might consider using single dispatch instead:

https://docs.python.org/3/library/functools.html#functools.singledispatch





-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list