beeprint
beeprint copied to clipboard
pp should take keyword arguments like pprint
It'd be nice to be able to set settings for pp with keyword arguments instead of using a new Config instance when we want to use it differently.
Perhaps something like:
def pp(o, output=True, max_depth=None, config=None, indent=None, width=None, sort_keys=None):
"""print data beautifully
"""
config = config or Config()
if max_depth is not None:
config.max_depth = max_depth
if indent is not None:
assert indent >= 0
config.indent_char = u' ' * indent
if width is not None:
assert width >= 0
config.string_break_width = width
if sort_keys is not None:
config.dict_ordered_key_enable = bool(sort_keys)
...
Ideally, it'd be better to include the default arguments instead of just None, but first you'd need to address the bug #17
Supported already?
pp(o, instance_repr_enable=False, max_depth=2)