class documentation
class PrivateDict(dict):
A dictionary that turns its values to private fields.
>>> PrivateDict() {} >>> supersekkrit = PrivateDict({"password": "foobar"}) >>> print(supersekkrit["password"]) <password> >>> supersekkrit["password"].Get() 'foobar' >>> supersekkrit.GetPrivate("password") 'foobar' >>> supersekkrit["user"] = "eggspam" >>> supersekkrit.Unprivate() {'password': 'foobar', 'user': 'eggspam'}
Method | __init__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method |
|
Like dict.get, but extracting the value in the process. |
Method |
|
Turn this dict of Private() values to a dict of values. |
Method | update |
Undocumented |
Like dict.get, but extracting the value in the process.
Arguments are semantically equivalent to ``dict.get``
>>> PrivateDict({"foo": "bar"}).GetPrivate("foo") 'bar' >>> PrivateDict({"foo": "bar"}).GetPrivate("baz", "spam") 'spam'