Created
December 21, 2022 18:56
-
-
Save msullivan/72167aae11caff4d5dcc5b9140dc2b65 to your computer and use it in GitHub Desktop.
automatically build a table of python operator functions
This file contains hidden or 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
import operator | |
OPS = { | |
x.__doc__.split()[3]: x | |
for k in dir(operator) | |
if not k.startswith('__') | |
and (x := getattr(operator, k)).__doc__.startswith("Same as a ") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment