.Tang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

命名风格:

类名: CapWords

模块文件名,函数,方法成员: lower_case_with_underscores

全局常量: UPPER_CASE_WITH_UNDERSCORES

引用计数垃圾回收机制:
通过名字完成‘引用传递’,名字关联会增加引用次数,反之减少。如删除全部名字关联,引用计数归零,该对象被系统回收。

            --  引用计数垃圾回收机制

 循环引用垃圾回收

处理循环引用垃圾回收器  --简称gc

eval执行单个表达式

>>> s = input()
100+2*0+1
>>> eval(s)
101

exec执行代码块

>>> s = """
def test():
     print('hello world')
test()
"""
>>> s
"\ndef test():\n\tprint('hello world')\ntest()\n"
>>> exec(s)
hello world

 

posted on 2018-08-29 12:28  .Tang  阅读(149)  评论(0编辑  收藏  举报