Fix Python – What does the caret (^) operator do?

I ran across the caret operator in python today and trying it out, I got the following output:
>>> 8^3
11
>>> 8^4
12
>>> 8^1
9
>>> 8^0
8
>>> 7^1
6
>>> 7^2
5
>>> 7^7
0
>>> 7^8
15
>>> 9^1
8
>>> 16^1
17
>>> 15^1
14
>>>

It seems to be based on 8, so I’m guessing some sort of byte operation? I can’t seem to find much about this searching sites other ….

Fix Python – What is `1..__truediv__` ? Does Python have a .. (“dot dot”) notation syntax?

I recently came across a syntax I never seen before when I learned python nor in most tutorials, the .. notation, it looks something like this:
f = 1..__truediv__ # or 1..__div__ for python 2

print(f(8)) # prints 0.125

I figured it was exactly the same as (except it’s longer, of course):
f = lambda x: (1).__truediv__(x)
print(f(8)) # prints 0.1….

Fix Python – 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?
….

Fix Python – How can I obtain the element-wise logical NOT of a pandas Series?

I have a pandas Series object containing boolean values. How can I get a series containing the logical NOT of each value?
For example, consider a series containing:
True
True
True
False

The series I’d like to get would contain:
False
False
False
True

This seems like it should be reasonably simple, but apparently I’ve misplaced my mojo =(
….