One thing that I quite like working in Python inside jupyter notebook is that I can use some unicode symbols to name my variables. For example, to use greek letters, I type \alpha followed by tab and I get α.
I just ran into an unexpected behaviour when using a bold capital T, \bfT followed by tab which results in .
The experiment is the following. Inside a cell (running Python 3) type:
T = 1
= 2
print(T) # prints 2
To my surprise, the second line is reassigning the variable T but I would expect it to be different from . Can somebody please explain what's the catch with using Unicode?
I don't know if it helps, but as another experiment, I can see that the same two symbols as strings are in fact different
'T'.encode('utf8'), ''.encode('utf8') # (b'T', b'\xf0\x9d\x90\x93')
How is the notebook processing my variable names?