[Python-ideas] dir with a glob?

Sturla Molden sturla at molden.no
Thu Jun 30 15:27:16 CEST 2011

Den 30.06.2011 14:29, skrev Ben Finney:
> We have list comprehensions and generator expressions to filter a 
> sequence, and I suspect they would serve you well for this purpose.

Dir is often used to explore objects or modules interactively, which 
means we need a very short syntax for this to be handy. Perhaps 
something like this:

dir(object, "foo*")

Making an utility function like this with glob or regex is of course 
extremely simple. Anyone can do it for themselves, how ever they like.

What I am asking is if the need to filter the output from dir is so 
common that it could warrant a change to Python?


More information about the Python-ideas mailing list