
Sturla Molden <sturla@molden.no> writes:
Often when exploring an object with the 'dir' function, particularly in large packages like SciPy, I find that I need to filter the outout.
We have list comprehensions and generator expressions to filter a sequence, and I suspect they would serve you well for this purpose.
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
What would you expect this to return? The ‘dir’ function is specifically for inspecting *one* object. Do you just want all the attributes of all the matching objects mixed up together, or what?
I believe a new dir functions is needed, or a change in the behviour of the current version.
This is ‘python-ideas’. What is your idea for the desired behaviour? What about using a list comprehension or generator expression to get what you want? -- \ “A learning experience is one of those things that say, “You | `\ know that thing you just did? Don't do that.”” —Douglas Adams, | _o__) 2000-04-05 | Ben Finney