[Python-Dev] PEP 340 -- loose ends

Michael Hudson mwh at python.net
Tue May 3 16:35:35 CEST 2005


Nick Coghlan <ncoghlan at gmail.com> writes:

> Paul Svensson wrote:
>> On Tue, 3 May 2005, Nick Coghlan wrote:
>> 
>>> I'd also suggest that the blocktemplate decorator accept any iterator, 
>>> not just
>>> generators.
>> 
>> 
>> So you want decorators on classes now ?
>
> A decorator is just a function - it doesn't *need* to be used with decorator 
> syntax. I just think the following code should work for any iterator:
>
>    block blocktemplate(itr):
>      # Do stuff

But in 

@blocktemplate
def foo(...):
    ...

blocktemplate isn't passed an iterator, it's passed a callable that
returns an iterator.

Cheers,
mwh

-- 
    . <- the point                                your article -> .
    |------------------------- a long way ------------------------|
                                       -- Christophe Rhodes, ucam.chat


More information about the Python-Dev mailing list