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

Martijn Faassen faassen@vet.uu.nl
Wed, 15 May 2002 23:22:27 +0200


Casey Duncan wrote:
> I think making people use an adapter just to get the behavior in a "pythonic" 
> way is nonsensical. And defeats the purpose of having the capability at all 
> IMHO.
> 
> Wouldn't it be cool to write:
> 
> for object in folder:
>   object.somethingorother()

Sure, but that wouldn't be the result of supporting the IMapping interface,
you'd need:

for object in folder.values():
    object.somethingorother()

instead

otherwise you'll just get the keys, at least if we follow the way Python2.2 
dictionary works..

Still, I still like the latter better than something like objectValues()

Regards,

Martijn