On Mon, Oct 30, 2017 at 2:45 PM, Gabriele Battaglia <iz4...@libero.it> wrote:
> Buon pome. > Nell'help di list.sort, Python 2.7, leggo: > > L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; > cmp(x, y) -> -1, 0, 1 > > Ma cmp, che può assumere -1, 0 o 1 come valori, cos'è, a cosa serve? > > Cmp sta per compara? Compara cosa? Compara due argomenti x e y, e restituisce -1 se x è minore di y, 0 se sono uguali, e 1 se x è maggiore di y >>> cmp(42, 666) -1 >>> cmp(666, 42) 1 >>> cmp(42, 42) 0 ㎝ -- |:**THE 🍺-WARE LICENSE** *(Revision ㊷)*: | <miron@🐍.it> wrote this mail. As long as you retain this | notice you can do whatever you want with this stuff. | If we meet some day, and you think this stuff is worth it, | you can buy me a 🍺 in return. —㎝ _______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python