What is "@" used for ?

gops patelgopal at gmail.com
Sun Jun 29 10:39:11 CEST 2008


Hi.

I am noob in python. while reading some source code I came across ,
this funny thing called @ in some function ,

def administrator(method):
    @functools.wraps(method)
    def wrapper(self, *args, **kwargs):
        user = users.get_current_user()
        if not user:
            if self.request.method == "GET":
 
self.redirect(users.create_login_url(self.request.uri))
                return
            raise web.HTTPError(403)
        elif not users.is_current_user_admin():
            raise web.HTTPError(403)
        else:
            return method(self, *args, **kwargs)
    return wrapper

now what is that "@" used for ? I tried to google , but it just omits
the "@" and not at all useful for me(funny!! :D)

It will be enough if you can just tell me some link where i can look
for it..

Thank you in advance. :D




More information about the Python-list mailing list