[Python-Dev] Backward-incompatible change to random.randrange in 2.7.6
barry at python.org
Tue Dec 17 19:55:46 CET 2013
-----BEGIN PGP SIGNED MESSAGE-----
On Dec 17, 2013, at 01:18 PM, Tres Seaver wrote:
>Do we really want to change an undocumented-but-effectively-public API in
>a late-in-the-release-cycle third dot release? It caused, ZODB's tests
>to fail, for instance.
>While the docstring said, "Don't use the 'int', 'default', and 'maxwidth'
>arguments", their names were not intrinsically private. In particular,
>passing in the 'int' argument was a strategy for generating compatible
>long values when straddling Python 2.x / Python 3.x.
Being quite sensitive to complaints about API breaks in patch releases, it
does seem like a bad idea to change these in a backward incompatible way.
It's true the docstring warns against it, and that the module does not
document those arguments, but they're still there and changing them breaks
existing code. That should be enough to revert and rewrite the change.
I don't think the API *has* to change in a backward incompatible way either.
The methods could be given **kws with a bit of hackery to figure out whether
the old API was being used (keys: int, default, maxwidth) or the new API was
being used (keys: _int and _maxwidth). Yeah it's ugly, but we serve our users
better by doing it that way.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Python-Dev