Just to be clear, this is about NotImplemented, not NotImplementedError.
tl;dr When a binary operation fails, should an exception be raised or
NotImplemented returned?
When a binary operation in Python is attempted, there are two possibilities:
- it can work
- it can't work
The main
See issue 22766 for some background on this question.
On Mon, 03 Nov 2014 02:30:53 -0800, Ethan Furman et...@stoneleaf.us wrote:
Just to be clear, this is about NotImplemented, not NotImplementedError.
tl;dr When a binary operation fails, should an exception be raised or
NotImplemented
On Mon Nov 03 2014 at 5:31:21 AM Ethan Furman et...@stoneleaf.us wrote:
Just to be clear, this is about NotImplemented, not NotImplementedError.
tl;dr When a binary operation fails, should an exception be raised or
NotImplemented returned?
The docs for NotImplemented suggest it's only for
On Mon, 03 Nov 2014 15:05:31 +, Brett Cannon br...@python.org wrote:
On Mon Nov 03 2014 at 5:31:21 AM Ethan Furman et...@stoneleaf.us wrote:
Just to be clear, this is about NotImplemented, not NotImplementedError.
tl;dr When a binary operation fails, should an exception be raised or
On 11/03/2014 08:12 AM, R. David Murray wrote:
On Mon, 03 Nov 2014 15:05:31 +, Brett Cannon br...@python.org wrote:
On Mon Nov 03 2014 at 5:31:21 AM Ethan Furman et...@stoneleaf.us wrote:
Just to be clear, this is about NotImplemented, not NotImplementedError.
tl;dr When a binary
On Mon, 3 Nov 2014 08:48:07 -0800
Guido van Rossum gu...@python.org wrote:
Gotta be brief, but NotImplemented is for all binary ops.
Even in-place ops?
Regards
Antoine.
Power may be an
exception because it's ternary?
On Nov 3, 2014 8:08 AM, Brett Cannon br...@python.org wrote:
On
Not those.
On Nov 3, 2014 8:56 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Mon, 3 Nov 2014 08:48:07 -0800
Guido van Rossum gu...@python.org wrote:
Gotta be brief, but NotImplemented is for all binary ops.
Even in-place ops?
Regards
Antoine.
Power may be an
exception because
Sorry, was too quick. For immutable types __iop__ may not exist and then
the fallback machinery should work normally using NotImplemented. But if
__iop__ exists it can choose not to allow __rop__, because the type would
presumably change. This is probably more predictable. I don't even know if
On Mon, 3 Nov 2014 09:05:43 -0800
Guido van Rossum gu...@python.org wrote:
Sorry, was too quick. For immutable types __iop__ may not exist and then
the fallback machinery should work normally using NotImplemented. But if
__iop__ exists it can choose not to allow __rop__, because the type would
That must be so that an immutable type can still implement __iop__ as an
optimization.
On Mon, Nov 3, 2014 at 9:10 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Mon, 3 Nov 2014 09:05:43 -0800
Guido van Rossum gu...@python.org wrote:
Sorry, was too quick. For immutable types __iop__ may
Summary:
NotImplemented _should_ be used by the normal and reflected binary methods
(__lt__, __add__, __xor__, __rsub__, etc.)
NotImplemented _may_ be used by the in-place binary methods (__iadd__, __ixor__, etc.), but the in-place methods are
also free to raise an exception.
Correct?
--
Sounds good!
On Mon, Nov 3, 2014 at 11:33 AM, Ethan Furman et...@stoneleaf.us wrote:
Summary:
NotImplemented _should_ be used by the normal and reflected binary methods
(__lt__, __add__, __xor__, __rsub__, etc.)
NotImplemented _may_ be used by the in-place binary methods (__iadd__,
I intend to write in lowest level of computer programming as a hobby.
It is true that is impossible write in binary code, the lowest level of
programming that you can write is in hex code?
What is the lowest level of programming computers that you can write ?
Is binary code?
Is hex code?
Is
Wait...you sent this to 9fans AND Python Dev??? Why not ask on StackExchange
Programmers http://programmers.stackexchange.com/ or something?
On Mon, Nov 3, 2014 at 5:19 PM, françai s romaper...@gmail.com wrote:
I intend to write in lowest level of computer programming as a hobby.
It is true
This is off-topic for this mailing list, as you know. There are some
mailing lists which approve of off-topic conversations, but this is not
one of those.
You could ask on the python-l...@python.org mailing list, where it will
still be off-topic, but the people there are more likely to answer.
15 matches
Mail list logo