plox.print.indent_print

Module for indented printing; both automatically and manually.

from plox.print import indent_print

Functions

indent_print(msg[, indent_level, indent_char])

Print a message with an appropriately indented prefix.

stack_size([size])

Get stack size for caller's frame.

Module Contents

plox.print.indent_print.indent_print(msg, indent_level=None, indent_char='|- ')

Print a message with an appropriately indented prefix.

Example

>>> from plox.print.indent_print import indent_print as printi
>>>
>>> def test():
...     printi("inside test")
>>>
>>> def test2():
...     printi("inside test2")
...     test()
>>>
>>> def test3():
...     printi("This it the inside of test3")
...     test2()
...     test()
>>>
>>> test3()
|- test3():This it the inside of test3
|- |- test2():inside test2
|- |- |- test():inside test
|- |- test():inside test
Parameters:
  • msg (str) – Message to print.

  • indent_level (Optional[int]) – Level to print at; if not given, will be determined automatically by stack/frame depth.

  • indent_char (str) – Set of chars to prefix the indents with.

plox.print.indent_print.stack_size(size=0)

Get stack size for caller’s frame.

Return type:

int