通过Python的内置程序了解所有的Python
Python as a language is comparatively simple. And I believe, that you can learn quite a lot about Python and its features, just by learning what all of its builtins are, and what they do. And to back up that claim, I’ll be doing just that.
作为一种语言,Python 是比较简单的。我相信,仅仅通过了解它的所有内建程序和它们的作用,你就可以学到很多关于 Python 和它的特性。为了支持这一主张,我将会这样做。
Just to be clear, this is not going to be a tutorial post. Covering such a vast amount of material in a single blog post, while starting from the beginning is pretty much impossible. So I’ll be assuming you have a basic to intermediate understanding of Python. But other than that, we should be good to go.
我想说的是,这不是一篇教程文章。在一篇博文中涵盖如此大量的材料,同时从头开始,这几乎是不可能的。所以我将假设你对Python有基本到中等程度的了解。但除此以外,我们应该可以开始了。
Index
索引
- Index
- 索引
- So what’s a builtin?
- 那么,什么是内置程序?
- ALL the builtins
- 所有的内置设备
- Exceptions
- 例外情况
- Constants
- 常数
- Funky globals
- 时髦的球状物
-
All the builtins, one by one
-
compile,execandeval: How the code works -
globalsandlocals: Where everything is stored -
inputandprint: The bread and butter -
str,bytes,int,bool,floatandcomplex: The five primitives -
object: The base -
type: The class factory -
hashandid: The equality fundamentals -
dirandvars: Everything is a dictionary -
hasattr,getattr,setattranddelattr: Attribute helpers -
super: The power of inheritance -
property,classmethodandstaticmethod: Method decorators -
list,tuple,dict,setandfrozenset: The containers -
bytearrayandmemoryview: Better byte interfaces -
bin,hex,oct,ord,chrandascii: Basic conversions -
format: Easy text transforms -
anyandall -
abs,divmod,powandround: Math basics -
isinstanceandissubclass: Runtime type checking -
callableand duck typing basics -
sortedandreversed: Sequence manipulators -
mapandfilter: Functional primitives -
len,max,minandsum: Aggregate functions -
iterandnext: Advanced iteration -
range,enumerateandzip: Convenient iteration -
slice -
breakpoint:...
-