如何将我的python代码共享给其他人?

如何将我的python代码共享给其他人?,python,Python,我想知道是否有任何方法可以将我的python代码作为库共享,人们可以使用它,但不能更改它 在ios中,我可以向其他人生成一个静态库和所有.h文件。程序员可以通过查看.h文件获得他可以使用的所有方法,但我不知道如何在Python中实现它?如何告诉一个人他可以使用哪些方法,比如.h文件?一个Python惯例(如中所述)是使用前导下划线命名属性: def _foo(): """You can call this function from your own code, but you

我想知道是否有任何方法可以将我的python代码作为库共享,人们可以使用它,但不能更改它

在ios中,我可以向其他人生成一个静态库和所有.h文件。程序员可以通过查看.h文件获得他可以使用的所有方法,但我不知道如何在Python中实现它?如何告诉一个人他可以使用哪些方法,比如.h文件?

一个Python惯例(如中所述)是使用前导下划线命名属性:

def _foo():
    """You can call this function from your own code, but you
    really shouldn't because I might change or remove it at
    any time without warning"""
    modify_guts_of_module()

def __bar():
    """Hands off. This is for the module implementation, not for
    public consumption. You can't even see this unless you go out
    of your way, and why would you do that?"""
    release_the_hounds()
这是Python隐藏属性并告诉其他人不应该使用它们的方式。

中的Python约定是使用前导下划线命名属性:

def _foo():
    """You can call this function from your own code, but you
    really shouldn't because I might change or remove it at
    any time without warning"""
    modify_guts_of_module()

def __bar():
    """Hands off. This is for the module implementation, not for
    public consumption. You can't even see this unless you go out
    of your way, and why would you do that?"""
    release_the_hounds()

这是隐藏属性并告诉其他人不应该使用它们的python方法。

您感兴趣的问题是什么?还有一个参考问题:我不需要保护我的代码,也许只是告诉人们他可以使用哪些方法只是记录它的属性并上传到。你感兴趣的问题是什么?还有一个参考问题:我不需要保护我的代码,也许只是告诉人们他可以使用哪些方法只是记录它的属性并上传到。