I've seen people use @s in Python but I never knew what they where for, I cant seem to figure out what it is used for. What is it used for?
Asked
Active
Viewed 101 times
-2
YoungerDryas
- 114
- 2
- 10
1 Answers
2
The @ symbol is used for class, function and method decorators.You can use a decorator to add some modified things that wouldn't be returned by function normally. Here is a nice example.
Ali Gajani
- 14,762
- 12
- 59
- 100
-
Can you put an example? – YoungerDryas Jun 07 '15 at 02:59
-
1This is a good [example](http://py-men.blogspot.com/2013/09/python-class-attributes-with-validation.html). – Ali Gajani Jun 07 '15 at 03:05