Skip to main content

All Purpose Set


Table of Contents


What is it?

  • A set which doesn't require hashable contents

Why create it?

  • I often have a need to store non-hashable contents in a set. For example storing a dict isn't possible with the builtin set.

    # doesn't work
    someDict = { "key": "value" }
    someSet = { someDict }
    

Simple usage

from all_purpose_set import ApSet

someDict = { "key": "value" }
someSet = ApSet([someDict])

print(someDict in someSet) # prints True

See also


Api

Note: This api is young and subject to change quite a bit. There also may be functionality present in the builtin set which this set doesn't cover. I'm willing to add it so please just raise a github issue or PR with details.

class ApSet([a list])

  • all methods return self unless specified otherwise
  • iterates in the order of insertion
  • currently the internal methods implemented are
    • __contains__
    • __iter__
    • __len__
add(something)
clear()
has(something) => bool
  • a function alternative to key in aSet
remove(something)
  • raises a KeyError if the element doesn't exist

Test

#
# you must have poetry installed
#
$ poetry shell
$ poetry install
$ python runTests.py

Release files for all-purpose-set 0.1.10

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

Source distribution (sdist)

Source distribution for all-purpose-set 0.1.10
File Size Uploaded
all_purpose_set-0.1.10.tar.gz 178.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for all-purpose-set 0.1.10
File Interpreter ABI Platform
all_purpose_set-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 386.9 kB

Release files / all_purpose_set-0.1.10.tar.gz

Download URL all_purpose_set-0.1.10.tar.gz
Size 178.2 kB
Tags Source
SHA-256 checksum
How to use checksums
abc26982d71973a1cd27c20eb1e889e228fe26804a5deeffab00ff3cd9dfd6d2
BLAKE2b-256 checksum
How to use checksums
7104c14bf8be22f2febc64d34d2789aaad36f1c14012fc32d6059ddcb053a144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.15 CPython/3.7.1 Linux/5.1.2-arch1-1-ARCH

Release files / all_purpose_set-0.1.10-py3-none-any.whl

Download URL all_purpose_set-0.1.10-py3-none-any.whl
Size 208.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ea32c0ca5937e22753b4f2d9ac7633fff47c605095f0ff58ae076fc5297cb09
BLAKE2b-256 checksum
How to use checksums
5ffa79ddcc203fe515cab78cc44b637257ca2a20d5e452129da453ae152225fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.15 CPython/3.7.1 Linux/5.1.2-arch1-1-ARCH

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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