Am I missing something?

Given Python's dynamic nature, there is simply no way to know if a method
is overriding a superclass' method until it is called -- and, now that I
think about it even then you don't know.

At compile time, none of the superclasses may have the given method.

At run time, a method could be monkey patched into the superclass before
the subclass' instance is created.

In fact, at run time, the superclass could get the method added after
instances are created.

At calling time, the subclass' method will be found, and used, and the
search stops there -- no way to know if there is one with the same name
further up the MRO.

This is simply incompatable with a language this dynamic.

On Fri, Nov 25, 2016 at 7:26 PM, Guido van Rossum <gu...@python.org> wrote:

> Here it's brought up from time to time and the response is usually "let a
> linter do it".
>

Exactly -- it can't be enforced, but maybe it's nice for a linter to give
some information at develop time.

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to