[Python-ideas] Delay evaluation of annotations

David Mertz mertz at gnosis.cx
Thu Sep 22 15:45:48 EDT 2016


On Thu, Sep 22, 2016 at 12:35 PM, אלעזר <elazarg at gmail.com> wrote:

> In such a hypothetical future world we might come to allow, e.g.
>> `Sequence[#CustomThing]` where some general lazy facility or indirection is
>> indicated by the '#' (just a placeholder for this comment, not a
>> proposal).  But if that comes about, it should be available everywhere, not
>> only in annotations.
>>
>
> I generally agree, but this future world must be very far and has many
> consequences, whereas the story of annotations is special in that it's not
> actually an expression, to the reader.
>

The CPython developers (of whom I'm not one, but I've followed them closely
for 18 years) place a high value on simplicity in the parser and
interpreter.  Adding a new custom type of thing that is an "annotation
object" would be a special case with a high burden to show its utility.

My feeling is that this burden is actually lower for a new "delayed eval
object" that might conceivably be added at a syntax level.  In some sense,
this would add just as much complexity as a new annotation object, but it
would be something that applies many places and hence perhaps be worth the
added complexity.

-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160922/b1026d97/attachment-0001.html>


More information about the Python-ideas mailing list