[Tutor] what does the "@" operator mean?
Lie Ryan
lie.1296 at gmail.com
Wed Dec 17 14:39:24 CET 2008
On Tue, 16 Dec 2008 01:03:55 +0000, Alan Gauld wrote:
> "Marc Tompkins" <marc.tompkins at gmail.com> wrote
>
>> If you're just starting out in Python, decorators can be hard to get
>> your head around...
>
> I've been using Python for oover 10 years and still find decorators hard
> to get my head around! :-)
>
> I confess I'm not a fan, they go against the Python spirit of explicit
> is best in my opinion. If I'm calling a function I like to know I'm
> calling a function... I know they make the code look pretty but IMHO
> they are a pain to debug and I'm never totally convinced I've got it
> exactly right.
I usually think about decorator as a tag or marker instead of function
calling. When I put the property decorator, I'll be thinking about
attaching a property tag to the function so the interpreter would handle
the function as if it is a property. This way, I don't think of it as
implicit function calling but as an explicit tag (how the tag system
works is a detail I need not to care).
More information about the Tutor
mailing list