Creating an object that can track when its attributes are modified
Lele Gaifax
lele at metapensiero.it
Wed Mar 6 11:56:05 EST 2013
Ben Sizer <kylotan at gmail.com> writes:
> I also believe that this won't catch modification to existing
> attributes as opposed to assignments: eg. if one of the attributes is
> a list and I append to it, this system won't notice. Is that something
> I can rectify easily?
It's really up to how far you wanna go: a similar use case is
implemented by SQLAlchemy__, which "instrument" builtin collection
classes to achieve the goal. But I'd not call that "easy" though :-)
ciao, lele.
__ http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/orm/collections.py
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it | -- Fortunato Depero, 1929.
More information about the Python-list
mailing list