ENH,PRF: ipstruct.py: class Struct(collections.OrderedDict or dict)#4
ENH,PRF: ipstruct.py: class Struct(collections.OrderedDict or dict)#4westurner wants to merge 1 commit intoipython:masterfrom
Conversation
westurner
commented
Dec 13, 2015
- cross-link w/ nbformat changes, ipython/jupyter version requirements & changelog
|
|
See also: jupyter/nbformat#30 "ENH: v4/nbjson.py: json.loads(object_pairs_hook=collections.OrderedDict)" |
|
From the README:
This package is an artifact of the Jupyter/IPython repo split, and we aren't planning to ever do another release of it, unless we find important bugs. Ultimately, we want to wean the other repos off of this one by shifting to standard utilities, such as six, etc. No new functionality should be added here. Any downstream changes that would rely on new features here should be implemented in the downstream repo instead of here. |
I did read that. I thought/think this solution is justifiable because:
From https://mail.python.org/pipermail/python-ideas/2015-November/037163.html : class OrderedDefaultDict(OrderedDict):
def __init__(self, default_factory=None, *a, **kw):
OrderedDict.__init__(self, *a, **kw)
self.default_factory = default_factory
def __missing__(self, key):
self[key] = value = default_factory()
return value |
|
Instead of
|
|
See jupyter/nbformat#30 for a discussion about:
|
|
Closing along with jupyter/nbformat#30. 'Struct' is possibly an unfortunate name. The class offers some features like Structs in other languages - primarily accessing items using |