[Python-3000] Function annotations considered obfuscatory (Re: Conventions for annotation consumers) (original) (raw)

Guido van Rossum guido at python.org
Wed Aug 16 06:04:41 CEST 2006


On 8/15/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

Collin Winter wrote:

> @docstring > @typechecker > @constrainvalues > def foo(a: {'doc': "Frobnication count", > 'type': Number, > 'constrainvalues': range(3, 9)}, > b: {'type': Number, > # This can be only 4, 8 or 12 > 'constrainvalues': [4, 8, 12]}) -> {'type': Number} There's another thing that's bothering me about all this. The main reason Guido rejected the originally suggested syntax for function decorators was that it put too much stuff into the function header and obscured the signature. Now we seem to be about to open ourselves up to the same problem on an even bigger scale. Who can honestly say that the above function declaration is easy to read? To me it looks downright ugly.

It's a worse-case scenario suggesting how one could solve a very hairy problem. I don't expect that something this extreme will be at all common (otherwise I'd be against it too).

PS. http://meyerweb.com/eric/comment/chech.html

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list