Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #44.2K
Which is smarter? class HoldAttr(object): pass a = HoldAttr b = getattr(a, 'attrname', []) b.append(1) setattr(a, 'attrname', b) # or try: b.a.append(1) except AttributeError: b.a = [1] ... or something else? Trying to learn. |
|
I think I can learn a lot from any answer to the two questions in this post. OK, I’ve got a large object. That object has attributes and does things. Those attributes also do things. MOST of what they do is sit there like a list, int, or np.array and … |