This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, rhettinger, tebeka
Date 2008-11-20.10:11:08
SpamBayes Score 1.36714e-09
Marked as misclassified No
Message-id <>
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-
Date User Action Args
2008-11-20 10:11:11mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, tebeka
2008-11-20 10:11:10mark.dickinsonsetmessageid: <>
2008-11-20 10:11:09mark.dickinsonlinkissue4356 messages
2008-11-20 10:11:08mark.dickinsoncreate