[Python-3000] Fwd: Conventions for annotation consumers
jimjjewett at gmail.com
Sun Aug 20 20:12:29 CEST 2006
On 8/19/06, Paul Prescod <paul at prescod.net> wrote:
> On 8/19/06, Ron Adam <rrr at ronadam.com> wrote:
> ... don't understand the virtue of bringing
> decorators into the picture. Yes, they are
> one consumer of metadata.
They aren't being brought in as sample *consumers*; they are being
suggested as *producers* of metadata.
The following works to assert the data
>>> def f(a, b):
We're discussing the alternative of
>>> def f(a:int, b):
which is better for some things -- but much worse for others; if the
metadata is any longer than int, it is almost certainly worse. So (I
believe) he is suggesting that we just reuse decorator syntax
... def f(a, b):
This keeps the single function declaration line short and sweet,
reflecting (modulo "self" and a colon) how it is actually called. It
gets the annotations (including type information) up where they should
be, but they don't overwhelm the variable names.
Whether to also add signature expressions (to make @sig decorators
easier to write) is a separate question; the key point is not to mess
with the one-line function summary.
More information about the Python-3000