This snippet defines a dir()
function which extends python's builtin dir()
function by adding options to filter the returned sequence of strings by the means of regular expressions. The main use case is live inspection of python objects and modules during an interactive session with the python interpreter.
The idea of such a function is not new. I remember having met similar functions in old modules by well known python gurus, Reddite Caesari quae sunt Caesaris !