Python论坛  - 讨论区

标题:Re: [python-chinese] hello me! __main__ 和self是何东东

2005年06月30日 星期四 15:11

Qutr qutianrang at gmail.com
Thu Jun 30 15:11:12 HKT 2005

我的建议是,你找本基础的书先好好看看!
http://www.byteofpython.info/language/chinese/index.html
你先把这个看看。


Qutr , qutianrang at gmail.com 
2005-6-30 
----- 收到以下来信内容 ----- 
发件人: jam.zheng 
收件人: Zoom Quiet,python-chinese 
时  间: 2005-06-30, 11:07:49
主  题: [python-chinese] hello me! __main__ 和self是何东东


各位大侠:
    __main__ -- Top-level script environment
This module represents the (otherwise anonymous) scope in which the
interpreter's main program executes -- commands read either from standard
input, from a script file, or from an interactive prompt. It is this
environment in which the idiomatic ``conditional script'' stanza causes a
script to run:
if __name__ == "__main__":
    main()

能帮我解释一下吗?

还有那个很多源码上用的 self 是什么东东

def __init__ (self, receiver, address):
        asynchat.async_chat.__init__ (self)
        self.receiver = receiver
        self.set_terminator (None)
        self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
        self.buffer = ''
        self.set_terminator ('\n')
        self.connect (address)

_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050630/4acab8b2/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号