class ABase(with_metaclass(ABaseMeta, object)): """abstract base class which introduces a nice constructor for the model classes.""" def __init__(self, *args, **kw): """ create a model object. pass attributes by using named parameters, e.g. name="foo", value=123 """ for k, v in kw.items(): setattr(self, k, v) def __str__(self): if hasattr(self, "__unicode__"): return self.__unicode__() def __getitem__(self, key): return getattr(self, key) def __setitem__(self, key, item): return setattr(self, key, item)
class Point(compat.with_metaclass(MetaPoint)): pass
class Point(compat.with_metaclass(MetaPoint)): @hybrid_property def _impl_double_x(self): return self.x * 2