Last active
December 11, 2015 11:09
-
-
Save ColtonPhillips/4592035 to your computer and use it in GitHub Desktop.
I left the terribad language comments in to demonstrate that dirtree is a half-brained attempt to improve how I use dir() when I code python. I'm saving it because I want to improve it a little as a hobby, and remind myself to keep looking for good alternatives to using dir()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
#It irks me greatly how my dir is just as useless as dir right now. sasuke it all away. | |
def _dirt_recurse(module, verbose=False, file=False, tab_width=0): | |
list = dir(module) | |
if file: | |
# TODO: put that shit in a file | |
pass | |
else: | |
for item in list: | |
if item.startswith("__") and not verbose: | |
pass | |
else: | |
#TODO: I'll need to rethink the recursive stuff when i can actually get a hook on when to stop recursing _ CP | |
print "|" + ("-" * tab_width) + "> " + item | |
# FUCK IT ILL JUST LIMIT IT AT LIKE 2 OR WHATEVER | |
# Pretty fucking useless, but serves as a demonstration | |
#if tab_width < 2: | |
# __dirt_recurse__(item,verbose,file,tab_width+1) | |
def dirt(module, verbose=False, file=False): | |
_dirt_recurse(module, verbose, file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment