Package grscheller.datastructures
Project description
Python grscheller.datastructures package
Data structures supporting a functional style of programming, yet still endeavor to be 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 desired behaviors.
- Don't force the raising of gratuitous exceptions upon client code leveraging this package.
- Safely handle mutating contained data by pushing it to a protected inner scope.
- Safely share data between data structure instances by pushing mutation to an outer scope and making shared immutable internal state inaccessible to client code.
- Allow for "lazy" evaluation avoiding race conditions by having iterators process non-mutating copies of data structure internal state.
- Code to the "happy" path & provide FP tools for "exceptional" events.
Sometimes the real power of a data structure comes not from what it enables you to do, but from what it prevents you from doing.
Data structure summary
Design choices
Type annotations
Type annotations used in this package are extremely useful in helping
external tooling work well. See PEP-563 & PEP-649. These features are
slated for Python 3.13 but work now in Python 3.11 by including
annotations from __future__
. This package was developed using
Pyright to provide LSP information to Neovim. This allowed the types
to guide the design of this package.
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 as better
ways to handle "missing" data.
Methods which mutate objects don't return anything.
For methods which mutate their data structures, I try to follow the Python convention of not returning anything, like the append method of the Python List builtin object. Most functional programming languages will return a reference to the data structure.
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.7.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48494ef9d1ff2412856df967b8f030725d1082e49e87ece7dbfd568bfee55edd |
|
MD5 | fb45d89e070e60ad355a014979211ecb |
|
BLAKE2b-256 | 1d86b3dd4d84559b77d6a5655bce58be74248c63dc48cfc8e6a0a2b1d7b9c854 |
Hashes for grscheller_datastructures-0.7.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d63816d7388cc2d956acbc7f063be8ccdeaca715daaeec0a1d21a33b721e8c |
|
MD5 | 07da9b4321dc3ccb6ca178e449cb6454 |
|
BLAKE2b-256 | e38a7971c61f34999804825853216c3347d77b2fce0a2c87d43dec6151974500 |