Enhanced dir() function
steve+comp.lang.python at pearwood.info
Fri Jul 1 06:29:35 CEST 2011
The dir() function is designed for interactive use, inspecting objects for
the names of attributes and methods.
Here is an enhanced version that allows you to pass a glob to filter the
names you see:
E.g. instead of this:
... snip 60+ other names ...
you can easily filter the results to show only names that interest you, by
passing a glob:
>>> dir(str, '*split*')
['rsplit', 'split', 'splitlines']
Comments and improvements welcome.
More information about the Python-list