operator ** and pow function behaves differently

Robert Vollmert rvollmert at gmx.net
Sun Jul 9 18:14:45 EDT 2000


> i am a newbie in the python world. from my understanding so far,
> i thought that ** operator and pow functions are symmetrical. but
> apparently i was wrong, e.g. -1**0 yields -1 but pow(-1,0) yields
> 1 (which is correct).

They basically are symmetrical (except for the optional third
argmument to pow...). Try (-1)**0. It's only that ** binds more
strongly than negation.

-- 
Robert Vollmert                                      rvollmert at gmx.net




More information about the Python-list mailing list