On Thu, Sep 22, 2016 at 10:45 PM David Mertz <me...@gnosis.cx> wrote:
> On Thu, Sep 22, 2016 at 12:35 PM, אלעזר <elaz...@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.
> I don't If this feature is "nice, but does not worth the complication",
then so be it; I can't claim I know better. I only speculate that it does
not necessarily requires a new custom type.
A delayed eval object will be very useful for initilizers, for the very
reason that the current behavior is surprising.
This made me think about Steven's argument above: it is not true that
expressions are evaluated when they are encountered, since
x = lambda: print(1)
prints nothing. So a colon before an expression hints about delayed
evaluation. This includes annotations and lambda.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/