what is meaning of "@" in pyhon program.
kyosohma at gmail.com
Fri Jun 27 17:03:19 CEST 2008
On Jun 27, 9:48 am, Evan <xdi... at gmail.com> wrote:
> When I check example of "cmd2" module (a enhancement of cmd module), I
> can not understand all, for example: the character "@",
> def options(option_list):
> ..........<function content>........
> class cmd(...):
> @options([make_option('-p', '--piglatin', action="store_true",
> I do not understand what "@options" does, most time, I know what the
> meaning of character "*" and character "**", but I was not use "@"
> Thanks for your help.
The "@" sign is there to signify that what follows is a decorator.
They're kind of cool and kind of confusing. Basically they dynamically
alter a function, method or class and gives them additional
functionality. It's kind of like calling a function recursively. Check
out the following links:
More information about the Python-list