pdir: Selective & Pretty dir() printing utlity
dir() is a very useful utility function in python which returns a list of names comprising the attributes of the given object, and of attributes reachable from it. However, a lot many times all those names can be bugging. Say you are really interested in knowing only the useful methods a Python “list” offers. And you do not like the unreadable, unfiltered mess resulting from using “dir(list)”.
Then pdir should be very useful for you. I wrote this bit because something like this is very helpful to me, who forgets some of the important functions a namespace offers; and likes reading clean pretty stuff.
Quickstart
You can use import the pdir function from pdir after installing this package, and consider it as your new dir() friend.
An example:
>>> from pdir import pdir >>> from collections import list >>> pdir(list) ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
Now lets compare this with what dir() prints:
>>> dir(list) ['__add__', '__class__', ......................................................... .................................................................................. 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
Some of the elements are substituted with dots (…) here.
Wasn’t the former clean and better?
Notes
pdir is essentially a wrapper around the existing dir function.
I will be trying to add interesting regular expressions support to further filter out pdir results.
Anyone who is interested in the code can see it ‘here’_ Its at its very rudimentary stage of development and may be unstable.
Metadata
Release files for pdir 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdir-0.1.tar.gz | 2.0 kB | Without provenance | Details for pdir-0.1.tar.gz |
Release files / pdir-0.1.tar.gz
| Download URL | pdir-0.1.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05d2c68f32a5f6f246f61477f2c0497e88fb7b9a7d66a37ec2f5bd4e81e27868
|
|
BLAKE2b-256 checksum How to use checksums |
f93e17a108d29822a58469306ec3f4babb8472b8358a210e9eb02ea2695044ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pdir 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.