classification
Title: 0 ** 0 should raise ArithmeticError
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Jáchym Barvínek, mark.dickinson, tim.peters
Priority: normal Keywords:

Created on 2016-10-25 14:57 by Jáchym Barvínek, last changed 2016-10-25 18:36 by mark.dickinson. This issue is now closed.

Messages (4)
msg279410 - (view) Author: Jáchym Barvínek (Jáchym Barvínek) Date: 2016-10-25 14:57
0 ** 0 is mathematically undefined and equivalent to 0/0. 0/0 correctly raises ZeroDivisionError, but 0 ** 0 == 1. Also 0.0 ** 0 == 0 ** 0.0 == 0.0 ** 0.0 == 0.0. Similarly for math.pow.
msg279411 - (view) Author: Jáchym Barvínek (Jáchym Barvínek) Date: 2016-10-25 14:58
Sorry, It should be 0.0 ** 0 == 0 ** 0.0 == 0.0 ** 0.0 == 1.0 of course.
msg279413 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2016-10-25 15:18
This won't be changed - it's a near-universally mandated behavior across relevant standards.  Many years ago it wasn't, but Knuth changed minds when he wrote:

"""
We must define x^0=1 for all x, if the binomial theorem is to be valid when x=0 , y=0 , and/or x=-y . The theorem is too important to be arbitrarily restricted!
"""

More here:

https://www.quora.com/Why-does-Python-return-1-for-pow-0-0-which-is-mathematically-wrong
msg279443 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-10-25 18:36
Also, https://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero
History
Date User Action Args
2016-10-25 18:36:19mark.dickinsonsetnosy: + mark.dickinson
messages: + msg279443
2016-10-25 15:18:41tim.peterssetstatus: open -> closed

type: behavior

nosy: + tim.peters
messages: + msg279413
resolution: not a bug
stage: resolved
2016-10-25 14:58:42Jáchym Barvíneksetmessages: + msg279411
2016-10-25 14:57:20Jáchym Barvínekcreate