Need help understanding some Python code
- by Yarin
I'm new to Python, and stumped by this piece of code from the Boto project:
class SubdomainCallingFormat(_CallingFormat):
@assert_case_insensitive
def get_bucket_server(self, server, bucket):
return '%s.%s' % (bucket, server)
def assert_case_insensitive(f):
def wrapper(*args, **kwargs):
if len(args) == 3 and not (args[2].islower() or args[2].isalnum()):
raise BotoClientError("Bucket names cannot contain upper-case " \
"characters when using either the sub-domain or virtual " \
"hosting calling format.")
return f(*args, **kwargs)
return wrapper
Trying to understand what's going on here.
What is the '@' symbol in @assert_case_sensitive ?
What do the args *args, **kwargs mean?
What does 'f' represent?
Thanks!