Package: dotdict-bench
dotdict-benchBenchmarking for dot-accessible dict packages in pythonMore test ideas?Submit an issue!Package InformationAs of 2022-09-21 23:11:19.354375PackageVersionLast CommitStarsForksDescriptionaddict2.4.0Tue, 05 Jan 2021 07:16:38 GMT2277137(i)python-box6.0.2Sat, 02 Apr 2022 02:24:21 GMT206289(i)dotmap1.3.30Wed, 06 Apr 2022 16:26:33 GMT36643(i)dotwiz0.4.0Wed, 21 Sep 2022 22:23:19 GMT201(i)easydict1.9Sun, 28 Feb 2021 10:26:53 GMT20739(i)dotsi0.0.3Sun, 22 Nov 2020 16:48:22 GMT181(i)dictlib1.1.5Thu, 15 Aug 2019 23:10:47 GMT143(i)diot0.1.6Thu, 12 May 2022 20:37:59 GMT72(i)Creating an object of the dict subclassHow the packages create an object of the dict subclassCreatedaddict{'a': {'b': {'c': 1}}}Type:Dictpython-box{'a': {'b': {'c': 1}}}Type:BoxdotmapDotMap(a=DotMap(b=DotMap(c=1)))Type:DotMapdotwiz✫(a=✫(b=✫(c=1)))Type:DotWizeasydict{'a': {'b': {'c': 1}}}Type:EasyDictdotsi{'a': {'b': {'c': 1}}}Type:DotsiDictdictlib{'a': {'b': {'c': 1}}}Type:Dictdiot{'a': Diot({'b': Diot({'c': 1})})}Type:DiotCreating a dict with preserved keysHow the packages create a dict with preserved keys
(e.g.keys,values,items, etc)Literally,{"keys": 1}Created or erroraddict{'keys': 1}python-box{'keys': 1}dotmapDotMap(keys=1)dotwiz✫(keys=1)easydict{'keys': 1}dotsi{'keys': 1}dictlibKey 'keys' conflicts with reserved worddiot{'keys': 1}Creating a dict with magic keysHow the packages create a dict with magic keys
(e.g.__name__,__class__, etc)Literally,{"__name__": 1}Created or erroraddict{'__name__': 1}python-box{'__name__': 1}dotmapDotMap(__name__=1)dotwiz✫(__name__=1)easydict{'__name__': 1}dotsi{'__name__': 1}dictlib{'__name__': 1}diot{'__name__': 1}Accessing valuesHow the packages to access valuesLiterally1from{"a": {"b": {"c": 1}}}Way to access valueaddict<dict>.a.b.cor<dict>['a']['b']['c']python-box<dict>.a.b.cor<dict>['a']['b']['c']dotmap<dict>.a.b.cor<dict>['a']['b']['c']dotwiz<dict>.a.b.cor<dict>['a']['b']['c']easydict<dict>.a.b.cor<dict>['a']['b']['c']dotsi<dict>.a.b.cor<dict>['a']['b']['c']dictlibdictlib.dig(<dict>, 'a.b.c')ordictlib.Dict(<dict>).a.b.cdiot<dict>.a.b.cor<dict>['a']['b']['c']Recursive Dot AccessWhether recursive dot access is supported when there are lists
in the dictLiterally<dict>.a.b[0].cfrom{"a": {"b": [{"c": 1}, {"d": 2}]}}Value or erroraddict1python-box1dotmap1dotwiz1easydict1dotsi1dictlibAttributeError: 'dict' object has no attribute 'c'diot1Automatic HierarchyWhether a hierarchical structure is created by dot notationLiterally<dict>.a.b.c = 1creates{"a": {"b": {"c": 1}}}Created or erroraddict{'a': {'b': {'c': 1}}}python-boxKeyError: "'Box' object has no attribute 'a'"dotmapDotMap(a=DotMap(b=DotMap(c=1)))dotwizAttributeError: 'DotWiz' object has no attribute 'a'easydictAttributeError: 'EasyDict' object has no attribute 'a'dotsiKeyError: 'a'dictlibKeyError: 'a'diotAttributeError: aAccessing values with preserved keysHow to access values with conflict keysLiterally, accessing values from{"keys": 1, "__name__": 2}Packageobj.keysobj['keys']obj.__name__obj['__name__']addict<built-in method keys of Dict object at 0x7f4455a49c70>122python-box<bound method Box.keys of Box({'keys': 1, '__name__': 2})>122dotmap<bound method DotMap.keys of DotMap(keys=1, __name__=2)>1AttributeError: __name__2dotwiz1122easydict1122dotsi<built-in method keys of DotsiDict object at 0x7f4455a49c70>122dictlibCan't createCan't createCan't createCan't creatediot<built-in method keys of Diot object at 0x7f4455a49c70>122Accessing dashed keysHow the values with keys with dash are accessedLiterally<dict>.a_bfor{"a-b": 1}Packageobj.a_bobj['a_b']obj['a-b']addict{}{}1python-box1KeyError: "'a_b'"1dotmapDotMap()DotMap()1dotwizAttributeError: 'DotWiz' object has no attribute 'a_b'KeyError: 'a_b'1easydictAttributeError: 'EasyDict' object has no attribute 'a_b'KeyError: 'a_b'1dotsiKeyError: 'a_b'KeyError: 'a_b'1dictlib111diot111Frozen Dict SupportWhether the packages support frozen dictsSupport? and how?addict<dict>.freeze()/.unfreeze()python-boxBox(<dict>, frozen_box=True)dotmapNot supporteddotwizNot supportedeasydictNot supporteddotsiNot supporteddictlibNot supporteddiotFrozenDiot(<dict>)orDiot(<dict>, diot_frozen=True)Key transformation supportWhether the packages support key transformation for dot accessFor example: making<dict>.a_bto access value from{"a.b": 1}Support? and how?addictNot supportedpython-boxUsing Conversion Box or Camel Killer BoxdotmapNot supporteddotwizDotWizPlusturns special-cased keys, such as names with spaces, into valid snake_case wordseasydictNot supporteddotsiNot supporteddictlibNot supporteddiotSupport custom transform function:Diot(..., diot_transform =...)