Misc Ideas for Enhancements #46
Replies: 3 comments
-
RAM-sensitive
|
Beta Was this translation helpful? Give feedback.
-
Clean up explicit toolsWe have a module for "explicit" stores: dol/explicit.py. Note that a lot of the same functionalities can be taken care of, more or less, via I'd propose to have a mini project where we analyze what's there, document and cover it with test it using AI, then try to replace with wrap_kvs-based code. Also, it would be nice to have some tutorial on this theme so that people (and AI) can better understand how to use it. Things to check outIn the following discussion comment, I'm using In config2py.base, there's a |
Beta Was this translation helpful? Give feedback.
-
Forwarding methods to extend mappings?Given the "special methods" ( from collections.abc import Mapping
class MappingHooks(Mapping):
def __iter__(self):
return self.__iter()
def __len__(self):
return self.__len()
def __contains__(self, key):
return self.__contains(key)
def __getitem__(self, key):
return self.__getitem(key)
class ExampleMapping(MappingHooks, Mapping):
"""Just forwards all method calls to the wrapped dict"""
def __init__(self, d: dict):
self.d = d
def __iter(self):
return iter(self.d)
def __len(self):
return len(self.d)
def __contains(self, key):
return key in self.d
def __getitem(self, key):
return self.d[key]
m = ExampleMapping({'a': 1, 'b': 2})
assert list(m) == ['a', 'b']
assert len(m) == 2
assert 'a' in m
assert 'b' in m
assert 'c' not in m
assert m['a'] == 1
assert m['b'] == 2 Notes:
|
Beta Was this translation helpful? Give feedback.
-
To collect miscellaneous ideas for enhancement, new features, interfaces, etc.
Beta Was this translation helpful? Give feedback.
All reactions