Message 76098 - Python tracker

Message76098

Author rhettinger
Recipients mark.dickinson, rhettinger, tebeka
Date 2008-11-20.12:44:06
SpamBayes Score 7.215748e-08
Marked as misclassified No
Message-id <1227185048.63.0.777664249722.issue4356@psf.upfronthosting.co.za>
In-reply-to
Content
I had said "almost always".  Sure, if you don't care about performance
or scalability, a key= argument would be a net win.

We're responsible for creating an API that steers most programmers in
the right direction (Tim sez "we read Knuth so you don't have to"). 
Algorithmically, the bisect functions are at the wrong level of
granularity for applying a key function.  

For user-defined objects, there is no need for a key-attribute since can
just supply a custom comparison method:

class UserDefined:
  . . .
  def cmp(self, other):
      return cmp(self.key, other.key)
History
Date User Action Args
2008-11-20 12:44:08rhettingersetrecipients: + rhettinger, tebeka, mark.dickinson
2008-11-20 12:44:08rhettingersetmessageid: <1227185048.63.0.777664249722.issue4356@psf.upfronthosting.co.za>
2008-11-20 12:44:07rhettingerlinkissue4356 messages
2008-11-20 12:44:06rhettingercreate