我们可以用前导下划线命名 python 个函数(不是方法!)吗?

Can we name python functions (not methods!) with leading underscores?

根据 PEP8,我们应该“使用一个前导下划线 only for non-public methods”[of classes].

我们可以使用相同的想法来区分“public”之间的模块(=文件)中的函数(=不属于任何class)从模块外部调用的函数和仅从模块内部调用的“非public”函数?还是不推荐这样做?不确定如何严格解释上述指南。

//编辑:附带问题:如果它被禁止,是否有其他有用的语法可用于该目的?

归功于@CoryKramer 指出 relevant section

In addition, the following special forms using leading or trailing underscores are recognized [...]:

  • _single_leading_underscore: weak "internal use" indicator. E.g. from M import * does not import objects whose names start with an underscore.