![](https://csdnimg.cn/release/download_crawler_static/86997377/bg5.jpg)
A class method receives the class as implicit first argument, just like an instance method
receives the instance. To declare a class method, use this idiom:
11.两两比较
cmp(
x
,
y
)
Compare the two objects
x
and
y
and return an integer according to the outcome.
The return value is negative if x < y, zero if x == y and strictly positive if x > y.
X 小于 X 输出负(-1),X 等于 Y 输出零(0),X 大于 Y 输出正(1)
用法:
12.
compile(
source
,
filename
,
mode
[,
flags
[,
dont_inherit
]])
Compile the
source
into a code or AST object. Code objects can be executed by an exec
statement or evaluated by a call to eval().
source
can either be a string or an AST object.
Refer to the ast module documentation for information on how to work with AST objects.
13.
complex([
real
[,
imag
]])
Create a complex number with the value
real
+
imag
*j or convert a string or number to a
complex number. If the first parameter is a string, it will be interpreted as a complex number
and the function must be called without a second parameter. The second parameter can
never be a string. Each argument may be any numeric type (including complex). If
imag
is