[Zope3-dev] Container interface issues

Martijn Faassen faassen at vet.uu.nl
Wed Sep 17 06:08:27 EDT 2003


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.

> Thoughts?

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.

Regards,

Martijn




More information about the Zope3-dev mailing list