Marc Tompkins wrote:
On Mon, Dec 15, 2008 at 5:03 PM, Alan Gauld <alan.ga...@btinternet.com> wrote:
I've been using Python for oover 10 years and still find decorators
hard to get my head around! :-)
I've only been using Python for a couple of years now, but my
experience so far is the same as yours: decorators make my head hurt.

Interesting. I actually rather like them and find them to be a tool to clean up code quite a bit. Python's ability to have classes offer "attributes" which are really handled by wrapper functions is a similar animal (in the sense that they can be very nice but also could be horribly abused to make smelly code).

That said, I don't find myself using them too often. Sort of like a special seasoning you add to the occasional dish but exotic enough to taste weird if you used it all the time.

For example, creating web apps in TurboGears uses decorators to expose methods, apply error handling and output templates without unnecessarily cluttering all your method definitions.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to