Non-ASCII identifiers for python 2.7

前端 未结 2 1779
失恋的感觉
失恋的感觉 2021-01-20 16:45

I know that in python 3.x I can use Non-ASCII identifiers (PEP 3131).

x1 = 2
x2 = 4
Δx = x2 - x1
print(Δx)

Is there such feature in python

2条回答
  •  囚心锁ツ
    2021-01-20 17:04

    Well, I mean, technically this is what you asked for:

    >>> x1 = 2
    >>> x2 = 4
    >>> locals()[u'Δx'] = x2 - x1
    >>> print locals()[u'Δx']
    2
    

提交回复
热议问题