Container __get/set/delitem__? (was Re: [Zope3-dev] naming issues: id vs name, delObject vs ?)

Max M maxm@mxm.dk
Tue, 14 May 2002 21:38:23 +0200


Jim Fulton wrote:

>Pros:
>
>  - More familiar. Less to remember.
>  - folder['foo'] is more readable than folder.getObject('foo')
>
>Cons:
>
>  - The change may cause too much confusion between containers and 
>    dictionaries or other mapping objects. Content containers are 
>    not dictionaries. They have more specific semantics and shouldn't be
>


I don't get it. Why are that cons?

I thought that the whole idea about Object Oriented programming was that 
you have diferrent namespaces for objects, so that you could use the 
same method names for objects which does approximately the same thing.

Saying that special method names are neede for an object which has dict 
behaviour but isn't quite a dict, is like saying that you should not 
subclass dicts at all, because the subclasses are not really dicts, but 
something a little different.

If it looks like a dict, smells like a dict and taste's like a dict, it 
must be a dict ... well and then some ;-)

Using the Python based method names is about as right as it can be. I think.

regards Max M