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
{{ message }}
Repository navigation
add a __getattr__ to Records so it looks cleaner #13
Couldn't this and #17 be solved using a way of specifying an alternative Record class, or factory function, to use? This way the user could even use namedtuples if so desired for memory efficiency.
Record is as memory efficient as Python's tuple (it's implemented in pure C). It's also faster than namedtuple to instantiate, since we have a freelist for it.
Activity
1st1 commentedon Jul 27, 2016
We considered having
__getattr__instead of__getitem__but decided against that, because:Recordobject, such as.keys(),.values()etc. We don't want field names to clash with Record's API.__getattr__and__getitem__doing the same thing feels non-pythonic.runfalk commentedon Aug 9, 2016
Couldn't this and #17 be solved using a way of specifying an alternative
Recordclass, or factory function, to use? This way the user could even use namedtuples if so desired for memory efficiency.1st1 commentedon Aug 9, 2016
Recordis as memory efficient as Python'stuple(it's implemented in pure C). It's also faster thannamedtupleto instantiate, since we have a freelist for it.1st1 commentedon Oct 20, 2016
I don't think we'll implement this. Adding
__getattr__will preclude us from adding methods/APIs to theRecordclass, so let's keep the status quo.