On Tue, Sep 7, 2010 at 10:51 PM, Mark Dickinson <dicki...@gmail.com> wrote:
> On Tue, Sep 7, 2010 at 10:47 PM, Jeffrey Yasskin <jyass...@gmail.com> 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.
>
> 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.

Ah.  I'd forgotten that the Decimal max and min methods are context
aware, so that max(x, y) is rounded to the current context, and hence
can actually be different from both x and y.  So that was a bad
example from me.  Sorry.

>>> from decimal import *
>>> getcontext().Emin = -500
>>> x, y = Decimal('-1e-100'), Decimal('-1e-1000')
>>> x.max(y)
Decimal('-0E-527')


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