Skip to main content

The standard library pprint module, but sets are always ordered.

Project description

PPrint Ordered Sets

The standard library pprint module, but with the feature that all sets are ordered.

Why does this package exist?

This package is a backport for the bug-fix bpo-27495. This package ensures that set and frozenset objects are always ordered, which is not true of the pprint module.

As of writing this, the pull request that fixes this bug has not been merged.

Example

>>> import pprint_ordered_sets as pprint
>>> obj = set("abcdefg")
>>> print(obj)  # Will be different on different systems.
{'d', 'f', 'b', 'g', 'e', 'a', 'c'}
>>> pprint.pp(obj)  # Will be same on all systems.
{'a', 'b', 'c', 'd', 'e', 'f', 'g'}

License

This code is licensed under the Python Software Foundation license, as this is a derivative work. My changes are adding the default ordering of set and frozenset objects, writing additional tests to cover these features, and renaming of this module to pprint_ordered_sets.

Testing

This package requires no dependencies to test, simply run:

python -m unittest test_pprint_ordered_sets.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pprint_ordered_sets-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

pprint_ordered_sets-1.0.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pprint_ordered_sets-1.0.0.tar.gz.

File metadata

  • Download URL: pprint_ordered_sets-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.0 Darwin/19.5.0

File hashes

Hashes for pprint_ordered_sets-1.0.0.tar.gz
Algorithm Hash digest
SHA256 742bf4f5912123f970d98bbca17379b1e610d9d025adbaadb3b37e439b50c174
MD5 8d8b0e9bfe4dadc07831e9fa7a04da91
BLAKE2b-256 5eb6cf6253e5c0c016c04c122ee1dae0803e9d75a20e410035ea9a0855c23ef7

See more details on using hashes here.

File details

Details for the file pprint_ordered_sets-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pprint_ordered_sets-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b4428fe51020e932ec5d8feed42cf8dd1dbcd85f1c99a9709010314ad9bd4e8
MD5 b313c1135309f1e644e21f65417d9d6b
BLAKE2b-256 c634e41b22133ae073883e20d96943690781766592e33c0348865673c36cef36

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page