Hello,

Apparently when you implement two methods with the same name:

def sub(x, y):
     print(x -y)

def sub(x, y):
     print(x -y)

Even with type hints.

def sub(x: int, y:int) -> int:
    return x - y

def sub(x: float, y:float) -> float:
    return 8

If you are from another background, you will expect the syntax with type
hints to act as though method overloading but instead last implementation
is always called. If this is the required behavior,then just flag any
duplicate method implementations as syntax errors.

Is this sort of method name duplication important in any cases?

Not aimed at criticism, just to understand.

-- 
Joannah Nanjekye
+256776468213
F : Nanjekye Captain Joannah
S : joannah.nanjekye
T : @Captain_Joannah
SO : joannah


*"You think you know when you learn, are more sure when you can write, even
more when you can teach, but certain when you can program." Alan J. Perlis*
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to