Use λ, φ, α, ... in jupyter notebook as in julia

As you probably know, you can use λ, φ, α, .., in any julia script. Is this also possible for python? I would use julia, but there are still packages from python that I would have to wrap.

Regards

+3


source to share


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.

+4


source







All Articles