我想看看所有的变数 [英] I want to see all the variables

查看:84
本文介绍了我想看看所有的变数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我使用dir()时,我没有看到__下划线项目。有什么

会显示所有私人变量和功能吗?


johnf

Hi,
When I use dir() I don''t see the __ underscore items. Is there anything
that will show all the private vars and functions?

johnf

推荐答案

johnf写道:
johnf wrote:



当我使用dir()时,我看不到__下划线项目。有什么

会显示所有的私人变量和功能吗?


johnf
Hi,
When I use dir() I don''t see the __ underscore items. Is there anything
that will show all the private vars and functions?

johnf



下划线项目的想法是,它们不会被你用到b
。如果你想访问私有变量和函数,你几乎肯定要查看源代码,以确保它们是什么以及它们如何被利用。


-Larry

The idea of the underscore items is that they aren''t to be used by
you. If you wish to access private variables and functions you will
almost certainly have to look at the source code to make sure of
what they are and how they can be utilized.

-Larry


你是什么意思?你能指出哪些特殊功能你不会看到它们吗?

我得到:

pyclass X:

通过

pydir(X)

[''__doc__'',''__ module _'']

pyclass X:

def __getitem __(self,x):

pass

pydir(X)

[''__doc__'','' __getitem__'',''__module__'']

12月29日下午12:35,johnf< jfabi ... @ yolo.comwrote:
What do you mean? Can you specify which special functions you don''t
see?
I get:
pyclass X:
pass
pydir(X)
[''__doc__'', ''__module__'']
pyclass X:
def __getitem__(self, x):
pass
pydir(X)
[''__doc__'', ''__getitem__'', ''__module__'']

On Dec 29, 12:35 pm, johnf <jfabi...@yolo.comwrote:



当我使用dir()时,我没有看到__下划线项目。是否有任何

将显示所有私人变量和功能?


johnf
Hi,
When I use dir() I don''t see the __ underscore items. Is there anything
that will show all the private vars and functions?

johnf


2006年12月29日星期五07:57:30 -0800, wi ****** @ hotmail.com 写道:
On Fri, 29 Dec 2006 07:57:30 -0800, wi******@hotmail.com wrote:

你是什么意思?你能指出哪些特殊功能你不会看到它们吗?

我得到:

pyclass X:

传递

pydir(X)

[''__doc__'',''_ _ _ module__'']
What do you mean? Can you specify which special functions you don''t
see?
I get:
pyclass X:
pass
pydir(X)
[''__doc__'', ''__module__'']



这些怎么样?

How about these?


>> X .__ dict__
>>X.__dict__



{''__module__'':''__ main__'',''__ doc__'':无}

{''__module__'': ''__main__'', ''__doc__'': None}


>> X .__ name__
>>X.__name__



''X''

''X''


>> X .__ bases__
>>X.__bases__



()


现在这很有趣......如果__name__和__bases__不要T住在

类__dict__,他们住在哪儿?还有什么其他方法和属性?
无形中X?

-

史蒂文。

()

Now that''s interesting... if __name__ and __bases__ don''t live in the
class __dict__, where do they live? What other methods and attributes are
invisibly in X?
--
Steven.


这篇关于我想看看所有的变数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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