On 8/30/13 8:13 PM, Steven D'Aprano wrote:
On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote:
In article <52200699$0$6599$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:
These days, it would be relatively simple to implement pre- and post-
condition checking using decorators, and indeed one of the motivating
use- cases for function annotations in Python 3 is to allow such
things.
http://www.python.org/dev/peps/pep-3107/
(Function annotations are perhaps the best Python feature that nobody
uses.)
This is awesome.
Heh, everybody has one of two reactions:
"This is awesome!"
"You'll add type checking to my Python code over my dead body!!!"
But I'm still to see a practical use for annotations in real world code.
Or indeed to think of a use for them other than type checking.
At PyCon 2007 (I think), Guido was giving a keynote about the features
coming in Py3k, and he couldn't remember the name "function
annotations." He said, "what are they called, the things that aren't
type declarations."
--Ned.
--
http://mail.python.org/mailman/listinfo/python-list