Generator metadata/attributes
Gerard Flanagan
grflanagan at gmail.com
Thu Jan 8 10:18:24 EST 2009
On Thu, 08 Jan 2009 08:42:55 -0600, Rob Williscroft wrote:
>
> def mydecorator( f ):
> def decorated(self, *args):
> logging.debug( "Created %s", self.__class__.__name__ )
> for i in f(self, *args):
> yield i
> return decorated
>
can optionally be written as:
def mydecorator( f ):
def decorated(self, *args):
logging.debug( "Created %s", self.__class__.__name__ )
return f(self, *args)
return decorated
More information about the Python-list
mailing list