Nick Coghlan wrote:
Guido van Rossum wrote:
No, the reason is that if we did this with exceptions, it would be
liable to mask errors; an exception does not necessarily originate
immediately with the code you invoked, it could have been raised by
something else that was invoked by that code. The
Greg Ewing wrote:
Is there some reason why Context couldn't invoke the binary
operator methods using binary operators, rather than calling
their methods directly?
I had a similar idea, but then I remembered that the whole point of invoking the
methods through a specific Context is to override the
Guido van Rossum wrote:
No, the reason is that if we did this with exceptions, it would be
liable to mask errors; an exception does not necessarily originate
immediately with the code you invoked, it could have been raised by
something else that was invoked by that code. The special value
On Tue, Mar 01, 2005 at 05:55:50PM -0500, Neil Schemenauer wrote:
On Tue, Mar 01, 2005 at 11:45:43PM +1000, Nick Coghlan wrote:
Interesting. In that case, my other suggestion was to have raising
NotImplementedError from a special method be the equivalent of returning
NotImplemented (which
Neil Schemenauer wrote:
IMO, Decimal should
be returning NotImplemented instead of raising TypeError.
I agree, but I'm also interested in the fact that nobody commented on this
before Python 2.4 went out. I read the reference page on numeric coercion more
times than I care to count, and still
Nick Coghlan [EMAIL PROTECTED] writes:
Neil Schemenauer wrote:
IMO, Decimal should
be returning NotImplemented instead of raising TypeError.
I agree, but I'm also interested in the fact that nobody commented on
this before Python 2.4 went out. I read the reference page on numeric
coercion
A recent question on c.l.p pointed out that the 2.4 Decimal implementation
raises TypeError directly for operator arguments it doesn't understand, instead
of returning NotImplemented.
Obviously, this creates problems for anyone trying to define a class that 'plays
nicely' with Decimal (but
A recent question on c.l.p pointed out that the 2.4 Decimal
implementation
raises TypeError directly for operator arguments it doesn't
understand,
instead
of returning NotImplemented.
Obviously, this creates problems for anyone trying to define a class
that
'plays
nicely' with Decimal
Raymond Hettinger wrote:
Try to address this in a larger context than decimal. The same sort of
logic is present in sets.py and in datetime objects.
Interesting. In that case, my other suggestion was to have raising
NotImplementedError from a special method be the equivalent of returning
On Tue, Mar 01, 2005 at 11:45:43PM +1000, Nick Coghlan wrote:
Interesting. In that case, my other suggestion was to have raising
NotImplementedError from a special method be the equivalent of returning
NotImplemented (which makes life much easier for a class like Decimal which
has an
10 matches
Mail list logo