[Tutor] easy way to populate a dict with functions

Kent Johnson kent37 at tds.net
Tue Aug 11 22:31:41 CEST 2009


On Tue, Aug 11, 2009 at 10:22 AM, bob gailer<bgailer at gmail.com> wrote:

> Decorator functions:
>
> def collect(func):
> 'a "decorator" that adds each function to the cmds list'
> cmds.append((func.__name__, func))

Decorators must return a callable, add to the above:

  return func

Kent


More information about the Tutor mailing list