[Zope-dev] Python3 and attribute annotations.

Dan Korostelev nadako at gmail.com
Tue Mar 10 04:58:52 EDT 2009


2009/3/10 Martijn Pieters <mj at zopatista.com>:
> On Mon, Mar 9, 2009 at 23:35, Dan Korostelev <nadako at gmail.com> wrote:
>> However, we can't be sure there won't be annotations for any callable
>> object, because even PEP says that ``we say function, we mean callable
>> object``, so one day we certainly will conflict with something. Also,
>> as Gary pointed out, we mis-use the __*__ name pattern that is now
>> intended for defining special names that have special meaning for
>> python interpreter. And we'll certainly will mis-use the
>> __annotations__ name as it's clearly defined in python 3k.
>>
>> So, after Gary reminded about __*__ names, I think we shoud use
>> something like "_z_annotations".
>
> Semi-agreed. Tools that access ZODB objects and expect __annotations__
> to follow the PEP 3107 conventions will be quite surprised. I doubt
> that there will be many tools to do so though.

Well, with ZODB, that tools don't need to know that objects are from
ZODB. To them they are simple Python objects and they expect
compatible behaviour.

> Then again, if Python is now explicitly claiming the __*__ naming
> convention, Zope better avoid it's usage. This means we'll have to fix
> __parent__ and __name__ usage as well. This will be painful, me
> thinks..

Yep, this will be the pain for sure. However, __parent__ and __name__,
and even __bases__ for component registries should be fine for now
(however we should think about moving them as well). But with
__annotations__ I expect much confusion and problems.

-- 
WBR, Dan Korostelev


More information about the Zope-Dev mailing list