python namespce 之built-in namespce

namespace

python的namespace主要就是一个从标识符到对象的字典。global namespace 指某个模块的全局名字。local namespace 指某个函数的本地名字。还有一个名字空间就是built-in namespce,指内置模块(__buildin__)的global namespace。

A namespace is a mapping from names to objects. Most namespaces are currently implemented as Python dictionaries, but that’s normally not noticeable in any way (except for performance), and it may change in the future. Examples of namespaces are: the set of built-in names (containing functions such as abs(), and built-in exception names); the global names in a module; and the local names in a function invocation.Python Scopes and Namespaces

__builtin__ module

这个总是容易和built-in modules傻傻分不清。
This module provides direct access to all ‘built-in’ identifiers of Python;
__builtin__ \— Built-in objects

而built-in modules则是指那些内置的的模块(都是用c语言实现的)。
The library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers.
built-in modules

所以__builtin__ module只是built-in modules中的一个。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值