[Zope3-dev] Container interface issues
Jim Fulton
jim at zope.com
Wed Sep 17 08:27:18 EDT 2003
Martijn Faassen wrote:
> Jim Fulton wrote:
>
>>- It's simpler for clients, as they can use a familiar syntax.
>>
>>Given the fact that containers must always be manipulated through
>>adapters, clients can't use the __setitem__ and __delitem__ operations
>>directly, so the second benefit goes away. In fact, the presense
>>of __setitem__ and __delitem__ might tempt clients to use them,
>>making them a liability.
...
I'm not sure what you are quoting here, but it's out of date.
As it turned out, clients do use __setitem__ and __delitem__. No adapters
are necessary. Containers are responsiblke for publishing events and
for maintaining __parent__ and __name__. This is made pretty trivial
through two helper functions.
> I think __setitem__ and __delitem__ are a liability them. Since
> __getitem__ is defined it is very natural to try to use __setitem__
> and it will seem to work, but it'll be buggy. I don't think adding
> clear documentation shouting loudly somewhere is a good way to solve
> that problem.
>
> Therefore I think it shouldn't be called __setitem__ and __delitem__, unless
> of course these can be made to do the right thing after all.
They do do the right thing after all. If you are quoting a current proposal,
please let me know which one so I can fix it.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (703) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list