-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before this commit, `pow` was the only binary function that doesn't use the corresponding operator but calls `pow` in `math`. This commit defines a `pow` function that invokes the corresponding operator (**). Using ** is preferable because it is slightly faster and preservers integers (see, https://www.semicolonworld.com/question/56223/exponentials-in-python-x-y-vs-math-pow-x-y). Moreover, it improves type compatibility, since now the function works with user-defined classes (as long as they have a __pow__ method), `math.pow` only supports numbers.
- Loading branch information
Showing
2 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters