Package grscheller.datastructures
Project description
PyPI grscheller.datastructures - release branch (v0.11.0)
Data structures geared to different algorithmic use cases. Supportive of both functional and imperative programming styles while endeavoring to remain Pythonic.
Overview
The data structures in this package:
- Allow developers to focus on the algorithms the data structures were designed to support.
- Take care of all the "bit fiddling" needed to implement data structure behaviors, perform memory management, and deal with edge cases.
- Mutate data structure instances safely by manipulating encapsulated data in protected inner scopes.
- Iterate over inaccessible copies of internal state allowing the data structures to safely mutate while iterators leisurely iterate.
- Safely share data between multiple data structure instances by making shared data immutable and inaccessible to client code.
- Don't force functional programming paradigms on client code, but provide functional tools to opt into.
- Don't force exception driven code paths upon client code. Except for Python iterators and syntax errors, exceptions are for "exceptional" events.
Sometimes the real power of a data structure comes not from what it empowers you to do, but from what it prevents you from doing to yourself.
Package overview grscheller.datastructures
Detailed API for grscheller.datastructures package
Design choices
None as "non-existence"
As a design choice, Python None
is semantically used by this package
to indicate the absence of a value.
How does one store a "non-existent" value in a very real data structure?
Granted, implemented in CPython as a C language data structure, the
Python None
"singleton" builtin "object" does have a sort of real
existence to it. Unless specifically documented otherwise, None
values
are not stored to these data structures as data.
Maybe
& Either
objects are provided in the functional sub-package as
better ways to handle "missing" data.
Methods which mutate objects don't return anything.
Data structures when mutated do not return any values. This package follows the convention used by Python builtins types of not returning anything when mutated, like the append method of the Python list.
Type annotations
Type annotations are extremely helpul for external tooling to work well.
This package was developed using Pyright to provide LSP information to
Neovim. This allowed the types to guide the design of this package.
While slated for Python 3.13, type annotations work now for Python 3.11
by including annotations from __future__
.
The best current information I have found so far on type annotations is in the Python documentation here. The PyPI pdoc3 package generates documentation based on annotations, docstrings, syntax tree, and other special comment strings. See pdoc3 documentation here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for grscheller_datastructures-0.11.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bba071e9832946130e084fdd9ab98186558591197455e29d0fdb35e686312363 |
|
MD5 | 0f936edce955957c5ea89ff04a8b6a15 |
|
BLAKE2b-256 | 2d9c586968a2ddfe08620866f9059ee1ed5b76a6812c86aaad863b1fa6c4b019 |
Hashes for grscheller_datastructures-0.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3915bd012b5536b08c71f3689be31d2b3284810a834cb9fc1ddabe0c9a9173c1 |
|
MD5 | 3c8a9384e3f408a741389f47dc116c71 |
|
BLAKE2b-256 | 09654708727fe4a3d4e3a3fb69158e750adeb21ae53132287bfdb4274a1ca10c |