[Python-ideas] dir with a glob?
sturla at molden.no
Thu Jun 30 13:38:07 CEST 2011
Often when exploring an object with the 'dir' function, particularly in
large packages like SciPy, I find that I need to filter the outout.
Since a dir reminds me of a dos 'dir' or linux 'ls', a glob feels like
the most natural to use.
For example, none of these would work:
>>> dir(sp.fft.i*) # syntax error
>>> dir('sp.fft.i*') # returns the attributes a string
I believe a new dir functions is needed, or a change in the behviour of
the current version.
Of course a 'glob aware dir function' can be implemented by monitoring
the call stack (cf. sys._getframe().f_back), but I think the problem is
general enough to warrant an official sultion.
More information about the Python-ideas