Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import re
# Custom grep
grep = lambda lib, regex : filter(lambda x :, x), dir(lib))
# Usage
# input: list(grep(bson, 'deco'))
# result: ['_utf_8_decode', 'decode_all', 'decode_file_iter', 'decode_iter']
# input: list(grep(numpy, '^a.*y$'))
# result: ['any', 'array', 'asanyarray', 'asarray', 'ascontiguousarray', 'asfarray', 'asfortranarray']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.