I would like to change the input arguments of a function. This will also lead to changes within the function body. What's a pythonic way to mark an input argument "deprecated" and maintain backward compatibility at the same time? Here's a toy example:
from typing import List
# original function
def sum_numbers(numbers: List[int]):
return sum(numbers)
# function with changed input arguments and function body
def sum_numbers(a: int, b: int) -> int:
return a + b
The user should be able to call sum_numbers either with numbers: List[int] argument or by using a: int, b: int. However, I want to submit a DeprecationWarning when the user uses the original call method.