printv(string, thisverbose=1, verbose=2, indent=2, **kwargs)[source]#

Optionally print a message and automatically indent. The idea is that a global or shared “verbose” variable is defined, which is passed to subfunctions, determining how much detail to print out.

The general idea is that verbose is an integer from 0-4 as follows:

  • 0 = no printout whatsoever

  • 1 = only essential warnings, e.g. suppressed exceptions

  • 2 = standard printout

  • 3 = extra debugging detail (e.g., printout on each iteration)

  • 4 = everything possible (e.g., printout on each timestep)

Thus a very important statement might be e.g.

>>> sc.printv('WARNING, everything is wrong', 1, verbose)

whereas a much less important message might be

>>> sc.printv(f'This is timestep {i}', 4, verbose)
  • string (str) – string to print

  • thisverbose (int) – level of verbosity at which to print this message

  • verbose (int) – global verbose variable

  • indent (int) – amount by which to indent based on verbosity level

  • kwargs (dict) – passed to print()

New in version 3.0.0: “kwargs” argument; removed “newline” argument