Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95239 > unrolled thread
| Started by | Vladimir Ignatov <kmisoft@gmail.com> |
|---|---|
| First post | 2015-08-10 23:22 -0400 |
| Last post | 2015-08-10 23:22 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
looking for standard/builtin dict-like data object Vladimir Ignatov <kmisoft@gmail.com> - 2015-08-10 23:22 -0400
| From | Vladimir Ignatov <kmisoft@gmail.com> |
|---|---|
| Date | 2015-08-10 23:22 -0400 |
| Subject | looking for standard/builtin dict-like data object |
| Message-ID | <mailman.59.1439263346.3627.python-list@python.org> |
Hi,
In my code I often use my own home-brewed object for passing bunch of
data between functions. Something like:
class Data(object):
def __init__ (self, **kwargs):
self.__dict__ = kwargs
....
return Data(attr1=..., attr2=..., attr3=...)
Logically it works like plain dictionary but with nice result.attrX
syntax on client side (instead of resut['attrX']). Overall I am
pretty happy with this approach except that I need to drag Data class
around my projects and import its module in every code producing data.
I am curious if anybody knows similar "dummy" class located in
standard libraries? I'd be glad to use it instead.
Thanks,
Vladimir
https://itunes.apple.com/us/app/python-code-samples/id1025613117
Back to top | Article view | comp.lang.python
csiph-web