[Python-ideas] Conventions for function annotations

Steven D'Aprano steve at pearwood.info
Sun Dec 2 23:23:25 CET 2012


On 02/12/12 22:43, Nick Coghlan wrote:

> Last time it came up, the collective opinion on python-dev was still to
> leave PEP 8 officially neutral on the topic so that people could experiment
> more freely with annotations and the community could help figure out what
> worked well and what didn't. Admittedly this was long enough ago that I
> don't remember the details, just the obvious consequence that PEP 8 remains
> largely silent on the matter, aside from declaring that function
> annotations are off-limits for standard library modules: "The Python
> standard library will not use function annotations as that would result in
> a premature commitment to a particular annotation style. Instead, the
> annotations are left for users to discover and experiment with useful
> annotation styles."

I fear that this was a strategic mistake. The result, it seems to me, is that
annotations have been badly neglected.

I can't speak for others, but I heavily use the standard library as a guide
to what counts as good practice in Python. I'm not a big user of third party
libraries, and most of those are for 2.x, so with the lack of annotations in
the std lib I've had no guidance as to what sort of things annotations could
be used for apart from "type checking".

I'm sure that I'm not the only one.



-- 
Steven



More information about the Python-ideas mailing list