Skip to content

_pprint_dict forces dictionary-style output for objects that inherit from dict #3251

@rcarneva

Description

@rcarneva

Because pprint_thing checks isinstance(thing, dict), it also catches objects that inherit from dict and forces them to print in the {'a':1, ... } format regardless of the object's unicode, str, or repr definitions. On my machine, I've changed the _pprint_dict function to just:

return unicode(seq)

which seems to give the behavior I'm looking for. I see pprint_thing warns against unicode(object) in general due to nested sequences, but since _pprint_dict doesn't do anything with _nest_lvl anyway, I figured it was probably safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Output-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions