On Mon, Nov 24, 2014 at 3:47 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> Hmmm, it appears that ** is a no-op that always returns its left hand
> argument:
>
> py> -1**12
> -1

Ahh but you see, you misunderstand how the whole negative-numbers
thing works. You have your syntax wrong. Python was developed by an
accountant, and you write negative numbers like this:

>>> (1)**12
1

And then, because you're raising it to an even power, you get back
positive one. The hyphen is actually an alignment operator, and it
means "left-align this value".

https://www.python.org/dev/peps/pep-0461/
https://docs.python.org/2/library/stdtypes.html#string-formatting

:)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to