David C. Ullrich wrote: > On Sun, 07 May 2006 10:36:00 -0400, Ken Tilton <[EMAIL PROTECTED]> > wrote: > > >>[...] >> >>Your spreadsheet does not have slots ruled by functions, it has one slot >>for a dictionary where you store names and values/formulas. >> >>Go back to your example and arrange it so a and b are actual slots (data >>members? fields?) of the spreadsheet class. You can just stuff numbers in a: >> >> sheet1.a = 42 >> >>but b should be somehow associated with a rule when sheet1 is created. >>As I said in the other post, also associate an on-change callback with >>slots a and b. > > > I must be missing something - seems this should be easy using > __setattr__ and __getattr__. Then _literally_ there's just a > dict containing names and functions, but when you _use_ the > class it looks just like the above:
Ah, but looks like is not enough. Suppose you have a GUI class from Tkinter. After a little more playing and fixing the huge gap described in the next paragraph you decide, Cripes! Kenny was right! This is very powerful. So now you want to subclass a Tkinter button and control whether it is enabled with a rule (the huge gap, btw). But the enabled flag of the super class is a native Python class slot. How would you handle that with your faux object system? Had you truly extended the Python class system you could just give the inherited slot a rule. Speaking of which... btw, You claimed "no lambda" but I did not see you doing a ruled value anywhere, and that is where you want the lambda. And in case you thinking your callbacks do that. No, you do not want on-change handlers propagating data to other slots, though that is a sound albeit primitive way of improving self-consistency of data in big apps. The productivity win with VisiCalc was that one simply writes rules that use other cells, and the system keeps track of what to update as any cell changes for you. You have that exactly backwards: every slot has to know what other slots to update. Ick. kenny -- Cells: http://common-lisp.net/project/cells/ "Have you ever been in a relationship?" Attorney for Mary Winkler, confessed killer of her minister husband, when asked if the couple had marital problems. -- http://mail.python.org/mailman/listinfo/python-list