Jim Fulton wrote:
> > This is, for example, useful for setting the precondition on __setitem__
> > method defintions for containers::
> >
> >   class IRecipeContainer(IContainer):
> >       def __setitem__(name, object):
> >           """Add a recipe"""
> >       __setitem__.precondition = ItemTypePrecondition(IRecipe)
> >
> > Having to use setTaggedValue would be a lot less syntactic sugar for
> > nothing.
> It's not for nothing. It's for separation of namespaces.
> (Tagged values are a lot like annotations in that respect.)

Indeed, I agree. Maybe we should re-design tagged values as annotations...

> Of course, the prefered way to express the above now is:
>    zope.app.container.contstraints.contains(IRecipe)

Yes, but this convenience function wasn't around for X3 3.0, so the old way is 
what's documented. I have no problem with deprecating that, in fact I'd be 
happy to do
so. It just can't be ripped out all at once. In other words, I would prefer 
having a
small proposal on this lining out the deprecation roadmap instead of a "+1 on 
ripping out
old APIs without overseeing all the consequences".

> > API inconsistencies usually have no specific reasons other than
> > bitrotting, I guess.
> Yeah, IOW, sounds like a bug.


> > I would say that a 'setTaggedValue' method is a bit unpythonic (it
> > actually feels quite Javaish).
> This is a very old api, going way back before z3.

Yes. Which means we need to be extra careful when touching it.

>  > I realize that the concept of tagged
> > values is well known from UML, that doesn't mean we can use pythonic
> > idioms for it though. I personally would prefer using the
> > __getitem__/__setitem__ protocol for this, but interfaces unfortunately
> > already use this for accessing interface members (e.g. IRecipe['name']).
> > I wish they would use the __getattr__ protocol (e.g. IRecipe.name).
> > Maybe it's not too late to change this, though it would be hard. It
> > would also make IInterface really tricky (what would
> > IInterface.implementedBy be?).
> I don't think there is really a need to change this.  If I was going
> to change this, I'd probably use the annotations approach.



This message was sent using IMP, the Internet Messaging Program.
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to