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 Sergey.Kirpichev
Recipients Sergey.Kirpichev, benjamin.peterson, mark.dickinson, matrixise, r.david.murray, rhettinger, tim.peters
Date 2015-04-29.15:03:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On Wed, Apr 29, 2015 at 02:32:34PM +0000, Benjamin Peterson wrote:
> Why does your key function depend on the size of the list?

Because it's a real life.  Here is the code:

Algorithm is recursive and computation of MRV set will be finished only
if I add an exceptional case for len(Omega).  Or even more ugly solution
with cmp-style function:

> Considering calling the key function is observable behavior, I don't think this
> should be changed. The patch makes behavior list.sort() inconsistent.

Yes, in some sense.

On another hand, it's reasonable to believe that key function will be
called iff we need one.  But if there is nothing to sort at all - why do
sorting, why you want to call key function?  Looks irrational to me.

Last by not least.  Why the return value of the key function *must*
be defined in this case?  Just a hidden, undocumented restriction and
has no practical value.

BTW, why this issue was closed?
Date User Action Args
2015-04-29 15:03:54Sergey.Kirpichevsetrecipients: + Sergey.Kirpichev, tim.peters, rhettinger, mark.dickinson, benjamin.peterson, r.david.murray, matrixise
2015-04-29 15:03:54Sergey.Kirpichevlinkissue24075 messages
2015-04-29 15:03:53Sergey.Kirpichevcreate