Mark Dickinson <[EMAIL PROTECTED]> added the comment:
What about cases where performance is unimportant, or where the key
function is fast (e.g. an attribute access)? Then something like
bisect(a, x, key=attrgetter('size'))
is easy to write and read. Mightn't this be considered good design,
from some perspectives?
Another thought: if your list is a list of user-defined objects then a
natural way to do the 'decorate' step of DSU might be to add a 'key'
attribute to each object, rather than the usual method of constructing
pairs. (This has the advantage that you might not have to bother with the
'undecorate' step.) With a key argument, bisect could make use of this
technique too.
Disclaimer: I haven't personally had any need for a key argument on
bisect, so all this is hypothetical. That's why I'm asking for real use-
cases.
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4356>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com