You are viewing an older version (9.12.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.12.0 / IPython / core / formatters / PlainTextFormatter

MetaHasTraits

IPython.core.formatters:PlainTextFormatter

source: /IPython/core/formatters.py :631

Signature

def   PlainTextFormatter ( ** kwargs : t.Any )  →  None

Members

Summary

The default pretty-printer.

Extended Summary

This uses IPython.lib.pretty to compute the format data of the object. If the object cannot be pretty printed, repr is used. See the documentation of IPython.lib.pretty for details on how to write pretty printers. Here is a simple example

def dtype_pprinter(obj, p, cycle):
    if cycle:
        return p.text('dtype(...)')
    if hasattr(obj, 'fields'):
        if obj.fields is None:
            p.text(repr(obj))
        else:
            p.begin_group(7, 'dtype([')
            for i, field in enumerate(obj.descr):
                if i > 0:
                    p.text(',')
                    p.breakable()
                p.pretty(field)
            p.end_group(7, '])')

Aliases

  • IPython.core.formatters.PlainTextFormatter