My package currently has a function that's something like:
def do_something(customer):
customer_id = customer.id if isinstance(customer, Customer) else customer
...
I'd like to be more strict about the argument type, and replace that with:
def do_something(customer_id):
...
However, I want to be very careful not to break users' code without going through a deprecation cycle. Adding a deprecation warning in the conditional (and then later removing the whole conditional) would suffice for most uses, but some users might be passing my customer
argument as a keyword argument, in which case my change will break their code.
Is there any way to transition my argument name from customer
to customer_id
, while not breaking any code, except through deprecation cycles where the old code still works?