Raymond Hettinger added the comment:

Sorry Julien, you don't to decide that long-standing APIs that have worked just 
fine for users are now a bad practice.  Some of these APIs (range, dict.pop, 
type) we designed by Guido and work fine in practice.  The expression, "don't 
have the tail wag the dog" comes to mind (where "tail" is the existing 
successful language and "dog" is the argument clinic).  Besides, API change is 
very disruptive to users (especially those trying to migrate to Python 3).

For the case of bisect, I've given a way forward.  It is okay to make the 
documented default value for "hi" to be "None" while internally still allowing 
-1 so that we don't break code that happens to depend on it.  In the clinic, 
use "hi: 'O' = None".  Then in the dispatch code, handle both the None case and 
the numeric case (see islice_new() in itertoolsmodule.c for some ideas on how 
to do this.

What isn't okay is to document and expose "hi=-1" because that is a confusing 
and error-prone default value that is just an awkward hack to express 
"hi=len(a)".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28754>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to