You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lots of the standard libs that come for free with python have, or could have, one or several read or read/write k/v perspectives.
We covered zipfile module with ZipReader already (still need to extend to ZipPersister), the csv module, but there's many more...
configparser
sqlite3
wave
chunk
zlib
gzip
bs2
lzma
tarfile
plistfile
dbm
mailbox.Maildir (mailbox.Mailbox already has a kv interface)
codecs
And of course, there's subsets of the modules that could use some kv interfaces. For example, consider inspect.Signature which contains some inspect.Parameter elements. Both dict-like.
As always, start as close to wrapped module as possible first, then transform/subclass/layer to create easier interfaces, consistency groups, or useful extensions.
Consider consistency groups of extensions. For example, any SpecificKvFileReader that takes a file as an input could be extended to a 'SpecificKvDirReaderwhose keys are the file paths or names of the directory and whose values areSpecificKvFileReader(file)`. It's a common useful pattern, so should be implemented as such.
The text was updated successfully, but these errors were encountered:
thorwhalen
changed the title
Stores for standard libs
KV perspectives for standard libs
Mar 6, 2020
linecache: Wrap to create list-like interface to file lines. If lines themselves are structured (such as csv), can go deeper in the list-like interface.
Lots of the standard libs that come for free with python have, or could have, one or several read or read/write k/v perspectives.
We covered
zipfile
module withZipReader
already (still need to extend toZipPersister
), thecsv
module, but there's many more...And of course, there's subsets of the modules that could use some kv interfaces. For example, consider
inspect.Signature
which contains someinspect.Parameter
elements. Both dict-like.As always, start as close to wrapped module as possible first, then transform/subclass/layer to create easier interfaces, consistency groups, or useful extensions.
Consider consistency groups of extensions. For example, any
SpecificKvFileReader
that takes a file as an input could be extended to a 'SpecificKvDirReaderwhose keys are the file paths or names of the directory and whose values are
SpecificKvFileReader(file)`. It's a common useful pattern, so should be implemented as such.The text was updated successfully, but these errors were encountered: