On Thu, Nov 4, 2021 at 2:29 AM Ethan Furman <et...@stoneleaf.us> wrote: > > One similarity that I don't think has been mentioned yet: > > - decorator syntax says, "run me later, after this function is built" > > - late-bound argument syntax says, "run me later, just before each function > call"
Hmm, I more think of decorator syntax as "modify this function". It runs at the same time that the def statement does, although the effects may be felt at call time (including a lot of simple ones like lru_cache). > Because both mean "run me later" we can leverage the @ symbol to aid > understanding; also, because "run me later" can > completely change the workings of a function (mutable defaults, anyone?), it > deserves more attention than being buried > in the middle of the expression where it is easy to miss (which is why I > originally proposed the ? -- it stood out better). One of the reasons I want to keep the latebound vs earlybound indication at the equals sign is the presence of annotations. I want to associate the lateboundness of the default with the default itself; consider: def func(spam: list = []) -> str: ... Which part of that becomes late bound? The [], not the name "list", not the name "spam". So if you want to make use of the at sign, it would end up looking like matrix multiplication: def func(spam: list @= []) -> str: ... def func(spam: list =@ []) -> str: ... rather than feeling like decorating the variable. Is that still valuable enough to prefer it? ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ROHV24OWFTJTD3IWEBKQY6ZA24GOTHO3/ Code of Conduct: http://python.org/psf/codeofconduct/