On 14/06/2018 10:27, Steve Barnes wrote:
Currently when working with interactive sessions using the dir() or
dir(module) built in is incredibly useful for exploring what
functionality is available in a module. (Especially the regrettable
libraries or modules that add really valuable functionality but have no
or limited docstrings).

However I often find that when a module adds a lot of functions I need
to filter those entries to be able to find the one that I need, e.g.:

  >>> import mpmath
  >>> dir(mpmath)  # This produces 390+ lines of output but
  >>> for name in dir(mpmath):
..    if 'sin' in name:
..        print(name)  # gives me a mere 13 to consider as candidates

What I would really like to do is:
  >>> dir(mpmath.*sin*)
I have also hit this use case.  But it never seemed like much of a hardship to write
    [  x for x in dir(SomeObject) if    <some condition on x>    ]
Rob Cliffe
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to