Re: Fire event when variable is Set/Get

2005-07-25 Thread Benji York
tharaka wrote: > You are in luck because Python has "Properties" just like .NET. > class C(object): > def getx(self): return self.__x > def setx(self, value): self.__x = value > def delx(self): del self.__x > x = property(getx, setx, delx, "I'm the 'x' property.") Just for those t

Re: Fire event when variable is Set/Get

2005-07-24 Thread Varghjärta
Thank you! Wow, this might be exactly what I want! Thanks to the pythonness (syntax) the code might even be shorter then implementing it in C#! Gonna go and play around with this some more(now), and can't wait til I get home (there will be some massive code cleaning). I wonder why I've never com

Re: Fire event when variable is Set/Get

2005-07-24 Thread gene tani
this recipe takes medium-deep copies (shallow copies of embedded sequences/dict's) of an obj's __dict__ when you need to monitor changes to the object's state from that point on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302742 -- http://mail.python.org/mailman/listinfo/python-list

Re: Fire event when variable is Set/Get

2005-07-24 Thread Mike C. Fletcher
Varghjärta wrote: ... 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

Re: Fire event when variable is Set/Get

2005-07-24 Thread tharaka
You are in luck because Python has "Properties" just like .NET. For details lookup the documentation of the built-in function property(). I'll just paste it here: property( [fget[, fset[, fdel[, doc) Return a property attribute for new-style classes (classes that derive from object). fget i

Re: Fire event when variable is Set/Get

2005-07-24 Thread Robert Kern
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. > >

Fire event when variable is Set/Get

2005-07-24 Thread Varghjärta
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