[Python-ideas] Improving the expressivity of function annotations
Nick Coghlan
ncoghlan at gmail.com
Tue Apr 5 12:34:04 CEST 2011
On Tue, Apr 5, 2011 at 4:35 PM, Masklinn <masklinn at masklinn.net> wrote:
> I would still think that, for the usage of function annotation to take off (and be used by multiple tools), there needs to be some kind of commonality between all tools. At least for the features closest to core.
You're free to think that. We disagree, as is explicitly documented in
PEP 3107: "Function annotations are nothing more than a way of
associating arbitrary Python expressions with various parts of a
function at compile-time."
Function annotations, on their own, mean absolutely nothing. They only
acquire meaning when associated with a specific consumer of those
annotations. If a decorator takes a lot of arguments about how to
handle particular parameters (or a function's return value), then it
is a prime candidate for refactoring to be annotation based instead.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list