[Tutor] easy way to populate a dict with functions

bob gailer bgailer at gmail.com
Wed Aug 12 03:27:59 CEST 2009


Kent Johnson wrote:
> 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

The docs indeed say that, but the interpreter does not enforce it. My 
example works as I designed it.


-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list