Varghjärta wrote: > Hey! > > I'm a hobby programmer since many years now and I've done most of my > latest 'real application' coding in C#. I've played with python of and > on yet not catching on until a few months ago when I got myself hocked > on it for real and now I love C# _and_ Python. > > But there is something that keeps bugging me, and that keeps me from > embracing Python even more as a serious alternative to C#(for me). In > C# I make heavy use of Get & Set, mainly to fire an event that some > property has changed so that one can act on that _if one would need > to. I've grown very used to doing it and it feels like the best way to > make very OO and reusuable and easy to use Classes. > > Is there _anything_ that I could do in Python which would allow me to > known when a variable has been set or when it's being fetched to allow > me to fire an event there?.
There's Enthought's Traits. http://code.enthought.com/traits/traits.htm I don't think it handles the Get part, though. You could probably come up with something using __getattribute__ for that part. http://docs.python.org/ref/new-style-attribute-access.html -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list