What's with the @ sign

jordan.taylor2 at gmail.com jordan.taylor2 at gmail.com
Tue May 23 19:13:55 CEST 2006

What's with code that has the @ symbol in front of classes or
functions?  This has probably already been asked but I can't find any
info on it.

Here is a slice of code I found that uses this, can someone please
explain what the @'s for??

def option_error_decorator(func):
    def wrapper(*a, **k):
            return func(*a, **k)
        except _socket.error, (errno, info):
            raise SocketOptionError(errno, info)
    return wrapper

def BoolOption(level, option):
    def getter(self):
        return bool(self._sock.getsockopt(level, option))
    def setter(self, value):
        return self._sock.setsockopt(level, option, int(value))
    return property(getter, setter)

Thanks in advance,

More information about the Python-list mailing list