[Zope-dev] Python3 and attribute annotations.
Dan Korostelev
nadako at gmail.com
Mon Mar 9 17:20:57 EDT 2009
Hi zope developers!
As you may know, python 3 introduced the concept of annotations for
callable objects. That annotations store information about arguments
and return values, which is kinda nice language feature that will
allow us to do interesting things.
But there's a problem: those annotations will be stored in object's
__annotations__ attribute, which is also used by zope.annotation's
AttributeAnnotation implementation, so they will conflict.
I think that it's a good time now to start thinking about problems
like this, because there's a lot of time before zope will be used in
python 3.0, so we can prepare to move without much problems.
So, I propose to change annotation storage attribute to
"__zope_annotation__" and make AttributeAnnotation adapter
automatically migrate data from __annotations__ to
__zope_annotations__. I think that adding "zope" to the attribute name
will avoid any name clashes in future.
I'd like to hear about problems that this change can possibly
introduce (__slots__, security proxies, etc.) and maybe some more
community ideas on that.
--
WBR, Dan Korostelev
More information about the Zope-Dev
mailing list