Extended functionalists and better control over Python's built-in print function
> pip install print-extended
If you run Python interpreter with -O
flag print will be disabled (watches for __debug__
):
python -O
>>> import print_extended
>>> print('foo')
>>>
Runing it without -O
flag works normal:
python
>>> import print_extended
>>> print('foo')
foo
>>>
Control your print with PrintControl
class:
from print_extended import PrintControl
PrintControl.template = '--> {print} <--'
PrintControl.fg_color = 'green'
PrintControl.bg_color = 'blue'
Change underlying print function:
from pprint import pprint
from print_extended import PrintControl
PrintControl.print_function = pprint
print({...}) # will print it using pprint
Disable and enable printing
from print_extended import PrintControl
PrintControl.disable() # print(...) now does nothing
PrintControl.enable() # print(...) now prints