python中的unicode标识符是不好的做法? [英] Are unicode identifiers in python bad practice?

查看:180
本文介绍了python中的unicode标识符是不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进入机器学习,并记录我的代码,我将编写我的函数的LaTeX数学版本,紧挨着Jupyter / IPython笔记本中的代码。数学定义包括许多希腊符号,所以我认为我不妨在函数和变量名中使用希腊符号,因为这在python中是可能的。这会是不好的做法吗?

I am getting into machine learning, and to document my code, I will write LaTeX math versions of my functions, right next to the code in an Jupyter/IPython notebook. The mathematical definitions include many Greek symbols, so I thought that I might as well use the Greek symbols in function and variable names, since that's possible in python. Would this be bad practice?

推荐答案

在这些假设下这似乎是一个很好的用例:

It seems a good use case under these assumptions:


  • 观众在数学上是精通的,

  • 你使用了许多Jupyter Notebook功能,例如内联绘图和
    表显示(例如pandas),以便在笔记本外部使用你的代码
    不太可能,

  • 它是应用程序代码而不是其他人将使用的库。

提示:在笔记本中输入希腊字母很简单。
只需输入LaTeX数学符号和TAB即可。
例如,键入:

Hint: Entering Greek letters in the notebook is simple. Just type the LaTeX math notation and TAB. For example, type:

\pi

然后使用TAB键获得π。

and then the TAB key to get a π.

这篇关于python中的unicode标识符是不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆