Skip to content

Instantly share code, notes, and snippets.

@msullivan
Created December 21, 2022 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msullivan/72167aae11caff4d5dcc5b9140dc2b65 to your computer and use it in GitHub Desktop.
Save msullivan/72167aae11caff4d5dcc5b9140dc2b65 to your computer and use it in GitHub Desktop.
automatically build a table of python operator functions
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