Every Single Punctuation In Python Explained
`(backtick)
Nothing. Legend says that the backtick was removed because it was too similar to the single quote character ‘
~ (tilde)
~ is known as the invert or complement operator. It is placed in front of objects that we want to invert.
If we place it in front of integer number n, we get ( -n — 1)
More useful example — when we place ~ in front of an object, we are actually calling its __invert__ method.
! (exclamation mark)
On its own, ! does nothing.
Combined with =, != becomes the inequality operator
^ it returns True if 2 values are not equal, and False if 2 values are equal.
@ (at sign)
We use @ to decorate functions.
Purpose of decorator functions — to add functionality to an existing function without having to change the function’s source code. This can be useful when we want to add some common functionality to multiple other functions.