Python 中的真正隐私 [英] True privateness in Python

查看:75
本文介绍了Python 中的真正隐私的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PEP 8 声明(强调我的):

PEP 8 states that (emphasis mine):

我们在这里不使用术语私有",因为在 Python 中没有真正私有的属性(通常没有不必要的工作量).

We don't use the term "private" here, since no attribute is really private in Python (without a generally unnecessary amount of work).

我猜它是指用其他语言定义实际的类,然后只将公共成员暴露给解释器.有没有其他方法可以在 Python 中实现真正的私密性?

I guess it refers to defining the actual class in some other language and then exposing only the public members to the interpreter. Is there some other way to achieve true privateness in Python?

我只是出于好奇而问.

推荐答案

不,Python 中没有什么是真正私有的.

No, nothing is truly private in Python.

如果你知道方法名,你就可以得到.

If you know the method name, you can get it.

我认为你可能会想出一个聪明的黑客,但它只是 - 一个黑客.该语言中不存在此类功能.

I think you might come up with a clever hack, but it would be just that - a hack. No such functionality exists in the language.

这篇关于Python 中的真正隐私的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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