[Python-3000] Function annotations considered obfuscatory (Re: Conventions for annotation consumers) (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Aug 16 03:09:54 CEST 2006
- Previous message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Next message: [Python-3000] Function annotations considered obfuscatory (Re: Conventions for annotation consumers)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
-- Greg
- Previous message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Next message: [Python-3000] Function annotations considered obfuscatory (Re: Conventions for annotation consumers)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]