On Tue, Sep 7, 2010 at 10:47 PM, Jeffrey Yasskin <jyass...@gmail.com> 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'))
> Decimal('2.0')
>>>> Decimal('2').min(Decimal('2.0'))
> Decimal('2.0')
>
> indicating that '2' is considered larger than '2.0' in the min/max
> comparison.

Right;  there's a strict specification about how equal values with
different exponents (or different signs in the case of comparing
zeros) should be treated.

> 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.

This bit surprises me.  I honestly thought I'd fixed it up so that
max(x, y) actually returned one of x and y (and min(x, y) returned the
other).  Oh well.

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to