[Python-ideas] dir with a glob?

Ben Finney ben+python at benfinney.id.au
Fri Jul 1 02:17:59 CEST 2011


Steven D'Aprano <steve at pearwood.info> writes:

> Nick Coghlan wrote:
> > On Thu, Jun 30, 2011 at 11:27 PM, Sturla Molden <sturla at molden.no> wrote:
> >> 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?
> >
> > No, if an object is complicated enough that pprint(dir(obj)) and
> > help(obj) aren't adequate to explore it, then it is time to go read
> > the documentation (or the source, if the documentation is lacking).
>
> Do you think that *reading the source* is to be preferred over a
> simple tool like running a filter over the output of dir()? I'm not
> exactly sure what point you're trying to make, but I don't think it's
> a good one.

I understood Nick's meaning to entail that in such a circumstance where
usage for a complex object is difficult to discover, the solution isn't
to alter Python but to address the poor documentation and/or poor design
of those complex objects.

But that might be because that's *my* position.

-- 
 \     “[F]reedom of speech does not entail freedom to have your ideas |
  `\    accepted by governments and incorporated into law and policy.” |
_o__)                                   —Russell Blackford, 2010-03-06 |
Ben Finney




More information about the Python-ideas mailing list