Created
August 28, 2018 04:42
-
-
Save HassankSalim/a3e0f27d3e140f48bdf0c820714f7c03 to your computer and use it in GitHub Desktop.
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
import re | |
# Custom grep | |
grep = lambda lib, regex : filter(lambda x : re.search(regex, 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