Currently the following doesn't work:
class Foo(Entity):
def bar(self):
""" behavior dependent on internal properties such as _key """
ent = dataset.entity()
baz = Foo(ent)
baz.bar()
This is inconsistent with Entity inheriting dict. Besides style issues, I would think sub-classing Entity would be the preferred way to introduce custom behavior, or enforce an entity schema.
Current workaround is:
class Foo(Entity):
def __init__(self, ent):
self._entity = ent
def bar(self):
""" behavior dependent on _entity """
Reactions are currently unavailable
Currently the following doesn't work:
class Foo(Entity): def bar(self): """ behavior dependent on internal properties such as _key """ ent = dataset.entity() baz = Foo(ent) baz.bar()This is inconsistent with Entity inheriting dict. Besides style issues, I would think sub-classing Entity would be the preferred way to introduce custom behavior, or enforce an entity schema.
Current workaround is:
class Foo(Entity): def __init__(self, ent): self._entity = ent def bar(self): """ behavior dependent on _entity """