Skip to main content
Build Tests

A pprint for CPython 3.6 dict objects that preserves insertion order.

About

CPython 3.6 uses a new “compact” representation for dict objects. As a nice side effect this happens to preserve the insertion order of keys.

The order-preserving aspect of this new implementation is considered an implementation detail and should not be relied upon

pprint.pprint() retains it’s behaviour from earlier Python releases. It formats a dict object by sorting the keys alphabetically.

>>> import pprint
>>> pprint.pprint({'foo': 1, 'bar': 2, 'baz': 3})
{'bar': 2, 'baz': 3, 'foo': 1}

oprint.pprint() throws out the old.

>>> import oprint
>>> oprint.pprint({'foo': 1, 'bar': 2, 'baz': 3})
{'foo': 1, 'bar': 2, 'baz': 3}

The library is otherwise a drop-in replacement for pprint.

Install

pip install oprint

Development

This project is developed on GitHub, please file issues for any feature or bug requests.

Contributors

Metadata

Release files for oprint 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oprint 0.1
File Size Uploaded
oprint-0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oprint 0.1
File Interpreter ABI Platform
oprint-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / oprint-0.1.tar.gz

Download URL oprint-0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b16b5c45ad5888e84348d88926effff140b296a40c62e9c18ac2a089210d4db4
BLAKE2b-256 checksum
How to use checksums
fac9aa72f852a1875b64d887010a79ca79d72197afad1b45dd9b41a68d63d8aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / oprint-0.1-py3-none-any.whl

Download URL oprint-0.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41c92990877987b7ab77f25397bfa1eaa0c2ad4995484bae9551905170b57eaf
BLAKE2b-256 checksum
How to use checksums
bc2411366700a0c4fda6cf8af389cad8faa760b8105909805605b691b98a8d31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page