From e9eea0f3eae011ad527618d2753ccc0f768ca653 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 23 Nov 2010 13:19:36 +0100 Subject: [PATCH] Allow DataHolder to have initial values --- src/pylorax/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pylorax/base.py b/src/pylorax/base.py index d8fb712c..3ee7bccd 100644 --- a/src/pylorax/base.py +++ b/src/pylorax/base.py @@ -51,6 +51,12 @@ class BaseLoraxClass(object): class DataHolder(dict): + def __init__(self, **kwargs): + dict.__init__(self) + + for attr, value in kwargs.items(): + self[attr] = value + def __getattr__(self, attr): return self[attr]