Page 98 -
P. 98
unhappy user
You’ve changed your API
Your new version of nester is indeed better, but not for all your users.
Ah, phooey! I can’t believe it... I installed
the latest version of “nester” from PyPI, and
now all of my code that uses your function is
not working. What did you do?!?
Get with the program,
Bob. You have TypeError’s
everywhere...
In your rush to release the lates and greatest version of your module, you
forgot about some of your existing users. Recall that not all of your users want
the new nested printing feature. However, by adding the second argument
to print_lol(), you’ve changed your function’s signature, which means
your module has a different API. Anyone using the old API is going to have
problems.
The ideal solution would be to provide both APIs, one which switches on the
new feature and another that doesn’t. Maybe the feature could be optional?
But how would that work?
62 Chapter 2