Use λ, φ, α, ... in jupyter notebook as in julia
1 answer
Python 3 supports λ, φ, α and many other Unicode characters in identifiers (as @jwodder mentioned). In jupyter notebook, you can access these symbols by typing
\<character name><tab>
Example
\alpha<tab> = 1
# α = 1
Not all Unicode characters can be used as variable names, eg. Emojis:
>>> ♥ = "love"
File "<ipython-input-29-97d253080b57>", line 1
♥ = "love"
^
SyntaxError: invalid character in identifier
However, alphabetic characters are allowed, especially in foreign languages:
>>> αγαπώ = "love"
>>> = "love"
>>> 愛 = "love"
See also David Bezley talk Mastering Python 3 I / O for more practical use of Unicode.
- REF 001: Unicode variables names
- REF 002: PEP 3131 - Support for Non-ASCII Identifiers
- REF 003: Unicode HOWTO
+4
source to share