This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Unexpected exponentiation in lambda function
Type: Stage:
Components: None Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bjodah, serhiy.storchaka
Priority: normal Keywords:

Created on 2012-08-16 15:30 by bjodah, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg168384 - (view) Author: Björn Dahlgren (bjodah) Date: 2012-08-16 15:30
Hi, I hope this is not a false positive but I cannot help thinking this is a bug, consider:

Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> -3.2**0
-1.0
>>> sign=lambda x: x**0
>>> sign(-3.2)
1.0

Python 3.2.3 (default, May  3 2012, 15:51:42) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> -3.2**0
-1.0
>>> sign=lambda x: x**0
>>> sign(-3.2)
1.0


Or is this expected?

Best regards,
Björn Dahlgren
msg168387 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-08-16 15:45
-3.2**0 == -(3.2**0)

>>> (-3.2)**0
1.0
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59897
2012-08-16 15:45:00serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg168387

resolution: not a bug
2012-08-16 15:30:11bjodahcreate