[Tutor] Writing decorators?
alan.gauld at yahoo.co.uk
Wed Jul 20 04:27:42 EDT 2016
On 20/07/16 09:08, Michael Welle wrote:
>> Don't be surprised, though, if the concept “replace the object
>> referenced by ‘foo’ with a different object and discard the prior object
>> at that reference“ is glossed to “change ‘foo’” in casual usage :-)
> I'm a bit surprised to see that kind of sloppy use of language on a
> Python list ;). But you are right, human language is imprecise.
Its not really sloppy. In English change means alter and
the function referenced by foo is altered by a decorator.
For example we could reasonably say that
foo = lambda x: x+1
creates a function called foo
And we can therefore also say that
foo = lambda x: x+2
changes the function foo.
Decorators change the function in a similar way.
It depends on whether you are referring to the function
name or the function object. So the use of change is not
necessarily sloppy but it could be imprecise. :-)
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor