Re: Model redesign?
Magnus Lie Hetland <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
Samuele Pedroni <[email protected]>: [snip] > the latter by the way is what more or less Dallas's code already do. > So I agree with Magnus that is far from true that it's wasted effort > ... What changes is that the model observes the compenent instead of > having the componenet take care of directly updating the model. Yes, I guess that is true. > It should be noted that under this approach unless one knows that no > model is attached to comp, is not guaranteed that this works: > > L=['a',...] > comp.items=L > > # later > L.insert(0,) > comp.push('items') > > unless set({items = }) for a list change the a preexisting list > in-place... You mean that the risk is that comp.items no longer refers to L? That is true. And, as I said, if we choose to go with this sort of decoupled approach (without direct in-place modification etc) we might also consider making all attributes work like the aliases. Thus, the above would be guaranteed *not* to work. > Otherwise the above idiom to be model-agnostic under this approach > should be: > > comp.items.insert('items',...) > comp.push('items') Again, this would be guaranteed not to work with copy semantics in the attributes. You'd have to do comp.items = 'foobar' + comp.items or something. This is an area where it seems we may potentially see some changes from the initial 0.2 design, but I think it's important that we get this right, so... > regards. -- Magnus Lie Hetland Practical Python The Anygui Project http://hetland.org http://ppython.com http://anygui.org ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf