Skip to main content

dir for humans

Project description

https://travis-ci.org/ljcooke/see.svg?branch=develop https://coveralls.io/repos/github/ljcooke/see/badge.svg?branch=develop

see is an alternative to dir(), for Python 2.6+ and 3.3+.

It neatly summarises what you can do with an object. Use it to inspect your code or learn new APIs.

Example

Say you have an object which you’d like to know more about:

>>> from datetime import timedelta

Try inspecting the object with see:

>>> see(timedelta)
    isclass             +                   -
    *                   /                   //
    %                   +obj                -obj
    <                   <=                  ==
    !=                  >                   >=
    abs()               bool()              dir()
    divmod()            hash()              help()
    repr()              str()               .days
    .max                .microseconds       .min
    .resolution         .seconds            .total_seconds()

Here we can discover some things about it, such as:

  • The object is a class.
  • You can add something to it with the + operator.
  • It has a seconds attribute.
  • It has a total_seconds attribute which is a function.

Compare with the output of dir:

>>> dir(timedelta)
['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '
__dir__', '__divmod__', '__doc__', '__eq__', '__floordiv__', '__
format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '
__init__', '__init_subclass__', '__le__', '__lt__', '__mod__', '
__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__radd__',
 '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rf
loordiv__', '__rmod__', '__rmul__', '__rsub__', '__rtruediv__',
'__setattr__', '__sizeof__', '__str__', '__sub__', '__subclassho
ok__', '__truediv__', 'days', 'max', 'microseconds', 'min', 'res
olution', 'seconds', 'total_seconds']

You can filter the results of see using a wildcard pattern or a regular expression:

>>> see(timedelta).filter('*sec*')
    .microseconds       .seconds            .total_seconds()

>>> see(timedelta).filter('/^d/')
    dir()       divmod()

Contributing

The source code is maintained on GitHub. Contributions are welcome.

Project details


Release history Release notifications

This version
History Node

1.4.1

History Node

1.4.0

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.0

History Node

1.1.1

History Node

1.1.0

History Node

1.0.1

History Node

1.0.0

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5

History Node

0.4.1

History Node

0.4.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
see-1.4.1-py2.py3-none-any.whl (12.3 kB) Copy SHA256 hash SHA256 Wheel 3.6 Sep 24, 2017
see-1.4.1.tar.gz (17.7 kB) Copy SHA256 hash SHA256 Source None Sep 24, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page