通过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
,exec
andeval
: How the code works -
globals
andlocals
: Where everything is stored -
input
andprint
: The bread and butter -
str
,bytes
,int
,bool
,float
andcomplex
: The five primitives -
object
: The base -
type
: The class factory -
hash
andid
: The equality fundamentals -
dir
andvars
: Everything is a dictionary -
hasattr
,getattr
,setattr
anddelattr
: Attribute helpers -
super
: The power of inheritance -
property
,classmethod
andstaticmethod
: Method decorators -
list
,tuple
,dict
,set
andfrozenset
: The containers -
bytearray
andmemoryview
: Better byte interfaces -
bin
,hex
,oct
,ord
,chr
andascii
: Basic conversions -
format
: Easy text transforms -
any
andall
-
abs
,divmod
,pow
andround
: Math basics -
isinstance
andissubclass
: Runtime type checking -
callable
and duck typing basics -
sorted
andreversed
: Sequence manipulators -
map
andfilter
: Functional primitives -
len
,max
,min
andsum
: Aggregate functions -
iter
andnext
: Advanced iteration -
range
,enumerate
andzip
: Convenient iteration -
slice
-
breakpoint
:...
-