-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Three unary operations are added to the `NumericType` data subclass: * `+`: Implemented through `__pos__` * `-`: Implemented through `__neg__` * `abs`: Implemented through `__abs__` The `__pos__` dunder overloads the unary plus operator `+` and returns the value of the object as-is, whereas the `__neg__` overloads the unary minus operator `-` and returns a new instance of the same class with the negation of the value of the original object. The `__abs__` dunder is called when the object is passed to the `abs` built-in and returns the absolute value.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
.eggs | ||
.vscode | ||
.tox | ||
Pipfile | ||
|
||
# files created by coverage | ||
.cache | ||
|
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