The tilde operator in Python
What’s the usage of the tilde operator in Python? One thing I can think about is do something in both sides of a string or list, such as check if a string is palindromic or not: def is_palindromic(s): return all(s[i] == s[~i] for i in range(len(s) / 2)) Any other good usage? 8 Answers 8