Trying to explain the importance of semantic versioning to a friend, I faced the following dilemma.
Let's say we have library libfoo
, version 1.2.3
that exposes the following function:
def foo(x, y):
"""
Compute the sum of the operands.
:param x: The first argument.
:param y: The second argument.
:returns: The sum of `x` and `y`.
"""
return x + y
Now assume that this function and its documentation change to:
def foo(a, b):
"""
Compute the sum of the operands.
:param a: The first argument.
:param b: The second argument.
:returns: The sum of `a` and `b`.
"""
return a + b
My first impression was to say that the next version would be 1.2.4
, as the public interface did not change. For example, someone calling the function like that would not notice the change at all:
foo(3, 4)
But thinking a bit further, this may very well be an API break, given that Python allows one to specify parameters by their names. If someone were to call my function like:
foo(y=4, x=3)
this would not work any more with the version 1.2.4
, breaking the semantic versioning contract.
On the other hand, such a change seems so small that I would feel bad about increasing the version to 2.0.0
.
To summarize, does this constitute an API break? What should the next version number be in this case?