obj.__dict__ or vars(obj)
Hi,
When I instantiate a class that uses Storm, vars(obj) and obj.__dict__ return unexpected results:
class Example(object):
__storm_table__ = "example"
id = Int(primary=True)
attribute = Int()
def __init__(self, attribute):
self.attribute = attribute
>>> ex = Example(50)
>>> ex
<__main__.Example object at 0xb10ed0>
>>> dir(ex)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__storm_
>>> vars(ex)
{'__storm_
>>> ex.__dict__
{'__storm_
>>> ex.id
>>> ex.attribute
50
In my opinion Storm breaks the semantics of vars() and __dict__.
Any idea how I could get a dict of all the attributes from an instance?
Cheers,
Justinus
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Storm Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Justin for more information if necessary.