1

I've seen in several places, but I still don't know what is the usage of '@' in python.

For example here:

class C:
    @staticmethod
    def f(arg1, arg2, ...): ...

Could someone make this all thing clear for me?

marcellnemeth
  • 27
  • 1
  • 3
  • 1
    Did you even briefly research this? https://stackoverflow.com/questions/6392739/what-does-the-at-symbol-do-in-python, for example. – jonrsharpe Oct 20 '19 at 16:54

1 Answers1

0

@ is for decorators. A decorator is the name used for a software design pattern. Decorators dynamically alter the functionality of a function, method, or class without having to directly use subclasses or change the source code of the function being decorated.

Frank
  • 1,959
  • 12
  • 27