[issue14825] Interactive Shell vs Executed code

Mark Dickinson report at bugs.python.org
Wed May 16 09:12:14 CEST 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

It sounds like you're seeing the difference between this:

>>> n = -7
>>> n ** 0
1

and this:

>>> -7 ** 0
-1

This isn't a bug;  it's to do with how Python expressions are parsed:  in the second case, the expression is grouped as -(7 ** 0) rather than (-7) ** 0.

BTW, it's helpful to post exact code when filing a possible bug. :-)

----------
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14825>
_______________________________________


More information about the Python-bugs-list mailing list