Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pretty printing types.MappingProxyType #9821

Description

@danilobellini

Since Python 3.3, types.MappingProxyType replaces the old types.DictProxyType from Python 2, but now it can be instantiated. However, pretty printing it is showing only its unsorted oneliner repr(obj) result.

In [1]: import types, string

In [2]: types.MappingProxyType({k: k for k in string.ascii_letters})
Out[2]: mappingproxy({'W': 'W', 'L': 'L', 'f': 'f', 'o': 'o', 'p': 'p', 'J': 'J', 'k': 'k', 'r': 'r', 'M': 'M', 'b': 'b', 'u': 'u', 'U': 'U', 'S': 'S', 'w': 'w', 's': 's', 'G': 'G', 'l': 'l', 'I': 'I', 'R': 'R', 'H': 'H', 'e': 'e', 'g': 'g', 'K': 'K', 'v': 'v', 't': 't', 'B': 'B', 'x': 'x', 'n': 'n', 'Y': 'Y', 'O': 'O', 'c': 'c', 'F': 'F', 'z': 'z', 'd': 'd', 'a': 'a', 'q': 'q', 'm': 'm', 'Q': 'Q', 'j': 'j', 'h': 'h', 'X': 'X', 'i': 'i', 'P': 'P', 'V': 'V', 'N': 'N', 'E': 'E', 'y': 'y', 'D': 'D', 'Z': 'Z', 'C': 'C', 'A': 'A', 'T': 'T'})

Tested in Python 3.5.2, IPython 5.0.0. I'm fixing this one myself due to #9776

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions