Message242233
On Wed, Apr 29, 2015, at 11:03, Sergey B Kirpichev wrote:
>
> Sergey B Kirpichev added the comment:
>
> 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:
> https://github.com/skirpichev/omg/blob/gruntz-use-subs/sympy/series/gruntz.py#L337
>
> 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:
> https://github.com/skirpichev/omg/blob/efc70377639f78fc0f246629989056cb80a71923/sympy/series/gruntz.py#L339
So, basically you need a base case for recursion? What's wrong with
explicitly writing that out?
>
> > 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.
It's practical if you have a broken key function and test it with a one
element list.
>
> BTW, why this issue was closed?
3 of us agreed this doesn't seem like a suitable change. |
|
Date |
User |
Action |
Args |
2015-04-29 15:25:19 | benjamin.peterson | set | recipients:
+ benjamin.peterson, tim.peters, rhettinger, mark.dickinson, r.david.murray, matrixise, Sergey.Kirpichev |
2015-04-29 15:25:19 | benjamin.peterson | link | issue24075 messages |
2015-04-29 15:25:18 | benjamin.peterson | create | |
|