On 19 Jan, 2007, at 11:42, Andi Vajda wrote:
On Fri, 19 Jan 2007, Grant Baillie wrote:
...
Anyway, is there a way to have the best of 1) and 2)? i.e. have
something that behaved like defaultValue=[], until you tried to
modify the collection? i.e. in code:
>>> class MyItem(schema.Item):
... myAttr = schema.Sequence(schema.Item, magicValue=[])
...
>>> x = MyItem(...)
>>> list(x.myAttr)
[]
>>> x.hasLocalAttributeValue('myAttr')
False
>>> x.myAttr.add(x)
>>> x.hasLocalAttributeValue('myAttr')
True
>>> x.myAttr.first()
<MyItem ....>
I sure could add something like that beyond what I described above.
Have a sort of Nil value that knows what to do when one attempts to
append to it.
In fact, shouldn't all many-valued attributes behave this way?
That could be useful in many cases, yes.
Is what we're discussing here something I should implement now or
are we just discussing various ideas, nice-to-haves ?
Personally, I have no objections to implementing these now.
I was just tossing around ideas, but if they're implementable and
make sense, I'd say go for it!
Also, if anyone has objections, squeak up soon :)
--Grant
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev