prepr#

class prepr(obj, maxlen=None, maxitems=None, skip=None, dividerchar='—', dividerlen=60, use_repr=True, private=False, sort=True, strlen=18, ncol=3, maxtime=3, die=False, debug=False)[source]#

Akin to “pretty print”, returns a pretty representation of an object – all attributes (except any that are skipped), plus methods and ID. Usually used via the interactive sc.pr() (which prints), rather than this (which returns a string).

Parameters:
  • obj (anything) – the object to be represented

  • maxlen (int) – maximum number of characters to show for each item

  • maxitems (int) – maximum number of items to show in the object

  • skip (list) – any properties to skip

  • dividerchar (str) – divider for methods, attributes, etc.

  • dividerlen (int) – number of divider characters

  • use_repr (bool) – whether to use repr() or str() to parse the object

  • private (bool) – whether to include private methods/attributes (those starting with “__”)

  • maxtime (float) – maximum amount of time to spend on trying to print the object

  • die (bool) – whether to raise an exception if an error is encountered

  • debug (bool) – print out detail during string construction

New in version 3.0.0: “debug” argument New in version 3.1.4: more robust handling of invalid object properties