[Python-3000] Draft pre-PEP: function annotations (original) (raw)
Paul Prescod paul at prescod.net
Sun Aug 13 08:47:29 CEST 2006
- Previous message: [Python-3000] Draft pre-PEP: function annotations
- Next message: [Python-3000] Draft pre-PEP: function annotations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/11/06, Collin Winter <collinw at gmail.com> wrote:
>>> def chain(*decorators): >>> assert len(decorators) >= 2 >>> >>> def decorate(function): >>> sig = function.signature >>> original = sig.annotations >>> >>> for i, dec in enumerate(decorators): >>> fake = dict((p, original[p][i]) for p in original) >>> >>> function.signature.annotations = fake >>> function = dec(function) >>> >>> function.signature.annotations = original >>> return function >>> return decorate
I must be confused. This is a function returning a function. Does that mean that the thing showing up in the signatures dictionary is a function? Or does the caller need to use two sets of parentheses to call the factory function and then the inner function?
Paul Prescod -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20060812/3263fd44/attachment.htm
- Previous message: [Python-3000] Draft pre-PEP: function annotations
- Next message: [Python-3000] Draft pre-PEP: function annotations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]