[Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?
Alan Gauld
alan.gauld at yahoo.co.uk
Thu Jul 7 04:36:56 EDT 2016
On 06/07/16 20:35, bruce wrote:
> But, what are decorators, why are decorators? who decided you needed them!
Thinking about this a little wider than Python.
Decorators are a standard software design pattern and were
first(?) formally documented in the famous book known as the
"Gang of Four" (GoF) but actually called "Design Patterns"
published in 1995.
But the GoF decorator pattern is quite different in the way
it is implemented (using object inheritance) from Python's
functional decorators. But the intent is the same - to add
common functionality to another object.
I think that's probably the earliest use of "decorator" in a
computing context.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list