Raymond Hettinger wrote:
>Matthew Woodcraft wrote:
>> In CPython, the builtin max() and min() have the property that if there
>> are items with equal keys, the first item is returned. From a quick look
>> at their source, I think this is true for Jython and IronPython too.
>> However, this isn'
On 09/07/2010 11:40 PM, Jeffrey Yasskin wrote:
Decimal may actually have this backwards. The idea would be that
min(*lst) == sorted(lst)[0], and max(*lst) == sorted(lst)[-1].
Here you mean "is" rather than "==", right? The relations you spelled
are guaranteed regardless of stability.
(This
On Sep 7, 2010, at 12:34 PM, Matthew Woodcraft wrote:
> In CPython, the builtin max() and min() have the property that if there
> are items with equal keys, the first item is returned. From a quick look
> at their source, I think this is true for Jython and IronPython too.
>
> However, this isn'
On Tue, Sep 7, 2010 at 11:00 PM, Mark Dickinson wrote:
> On Tue, Sep 7, 2010 at 10:51 PM, Mark Dickinson wrote:
>> On Tue, Sep 7, 2010 at 10:47 PM, Jeffrey Yasskin wrote:
>>> It's ignoring the order of the arguments. It also creates
>>> a new Decimal object for the return value, so I can't use i
On Tue, Sep 7, 2010 at 10:51 PM, Mark Dickinson wrote:
> On Tue, Sep 7, 2010 at 10:47 PM, Jeffrey Yasskin wrote:
>> It's ignoring the order of the arguments. It also creates
>> a new Decimal object for the return value, so I can't use id() to
>> check which one of identical elements it returns.
>
On Tue, Sep 7, 2010 at 10:40 PM, Jeffrey Yasskin wrote:
> Decimal may actually have this backwards. The idea would be that
> min(*lst) == sorted(lst)[0], and max(*lst) == sorted(lst)[-1]. Given a
> stable sort, then, max of equivalent elements would return the last
> element, and min the first.
Y
On Tue, Sep 7, 2010 at 10:47 PM, Jeffrey Yasskin wrote:
> Actually, Decimal isn't doing anything along these lines. At least in
> Python 2.6, I get:
>
Decimal('2').max(Decimal('2.0'))
> Decimal('2')
Decimal('2.0').max(Decimal('2'))
> Decimal('2')
Decimal('2.0').min(Decimal('2'))
> D
On Tue, Sep 7, 2010 at 2:40 PM, Jeffrey Yasskin wrote:
> On Tue, Sep 7, 2010 at 1:44 PM, Mark Dickinson wrote:
>> On Tue, Sep 7, 2010 at 8:34 PM, Matthew Woodcraft
>> wrote:
>>> In CPython, the builtin max() and min() have the property that if there
>>> are items with equal keys, the first item
On Tue, Sep 7, 2010 at 1:44 PM, Mark Dickinson wrote:
> On Tue, Sep 7, 2010 at 8:34 PM, Matthew Woodcraft
> wrote:
>> In CPython, the builtin max() and min() have the property that if there
>> are items with equal keys, the first item is returned. From a quick look
>> at their source, I think thi
Mark Dickinson wrote:
> Matthew Woodcraft wrote:
>> In CPython, the builtin max() and min() have the property that if there
>> are items with equal keys, the first item is returned. From a quick look
>> at their source, I think this is true for Jython and IronPython too.
> It's actually not clear
FWIW: I think Mark is right. I never quite understood why that was, but
never cared enough to complain.
lvh
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/
On Tue, Sep 7, 2010 at 8:34 PM, Matthew Woodcraft
wrote:
> In CPython, the builtin max() and min() have the property that if there
> are items with equal keys, the first item is returned. From a quick look
> at their source, I think this is true for Jython and IronPython too.
It's actually not cl
In CPython, the builtin max() and min() have the property that if there
are items with equal keys, the first item is returned. From a quick look
at their source, I think this is true for Jython and IronPython too.
However, this isn't currently a documented guarantee. Could it be made
so? (As with
13 matches
Mail list logo