数据类型之int

class int(object):
"""
int(x=0) -> int or long
int(x, base=10) -> int or long

Convert a number or string to an integer, or return 0 if no arguments
are given. If x is floating point, the conversion truncates towards zero.
If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must be a string or
Unicode object representing an integer literal in the given base. The
literal can be preceded by '+' or '-' and be surrounded by whitespace.
The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
interpret the base from the string as an integer literal.
>>> int('0b100', base=0)
"""
def bit_length(self):
""" 返回表示该数字的时占用的最少位数 """
"""
int.bit_length() -> int

Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
"""
return 0

def conjugate(self, *args, **kwargs): # real signature unknown
""" 返回该复数的共轭复数 """
""" Returns self, the complex conjugate of any int. """
pass

def abs(self):
""" 返回绝对值 """
""" x.abs() <==> abs(x) """
pass

def add(self, y):
""" x.add(y) <==> x+y """
pass

def and(self, y):
""" x.and(y) <==> x&y """
pass

def cmp(self, y):
""" 比较两个数大小 """
""" x.cmp(y) <==> cmp(x,y) """
pass

def coerce(self, y):
""" 强制生成一个元组 """
""" x.coerce(y) <==> coerce(x, y) """
pass

def divmod(self, y):
""" 相除,得到商和余数组成的元组 """
""" x.divmod(y) <==> divmod(x, y) """
pass

def div(self, y):
""" x.div(y) <==> x/y """
pass

def float(self):
""" 转换为浮点类型 """
""" x.float() <==> float(x) """
pass

def floordiv(self, y):
""" x.floordiv(y) <==> x//y """
pass

def format(self, *args, **kwargs): # real signature unknown
pass

def getattribute(self, name):
""" x.getattribute('name') <==> x.name """
pass

def getnewargs(self, *args, **kwargs): # real signature unknown
""" 内部调用 __new__方法或创建对象时传入参数使用 """
pass

def hash(self):
"""如果对象object为哈希表类型,返回对象object的哈希值。哈希值为整数。在字典查找中,哈希值用于快速比较字典的键。两个数值如果相等,则哈希值也相等。"""
""" x.hash() <==> hash(x) """
pass

def hex(self):
""" 返回当前数的 十六进制 表示 """
""" x.hex() <==> hex(x) """
pass

def index(self):
""" 用于切片,数字无意义 """
""" x[y:z] <==> x[y.index()😒.index()] """
pass

def init(self, x, base=10): # known special case of int.init
""" 构造方法,执行 x = 123 或 x = int(10) 时,自动调用,暂时忽略 """
"""
int(x=0) -> int or long
int(x, base=10) -> int or long

Convert a number or string to an integer, or return 0 if no arguments
are given. If x is floating point, the conversion truncates towards zero.
If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must be a string or
Unicode object representing an integer literal in the given base. The
literal can be preceded by '+' or '-' and be surrounded by whitespace.
The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
interpret the base from the string as an integer literal.
>>> int('0b100', base=0)
# (copied from class doc)
"""
pass

def int(self):
""" 转换为整数 """
""" x.int() <==> int(x) """
pass

def invert(self):
""" x.invert() <==> ~x """
pass

def long(self):
""" 转换为长整数 """
""" x.long() <==> long(x) """
pass

def lshift(self, y):
""" x.lshift(y) <==> x<<y """
pass

def mod(self, y):
""" x.mod(y) <==> x%y """
pass

def mul(self, y):
""" x.mul(y) <==> x*y """
pass

def neg(self):
""" x.neg() <==> -x """
pass

@staticmethod # known case of new
def new(S, *more):
""" T.new(S, ...) -> a new object with type S, a subtype of T """
pass

def nonzero(self):
""" x.nonzero() <==> x != 0 """
pass

def oct(self):
""" 返回改值的 八进制 表示 """
""" x.oct() <==> oct(x) """
pass

def or(self, y):
""" x.or(y) <==> x|y """
pass

def pos(self):
""" x.pos() <==> +x """
pass

def pow(self, y, z=None):
""" 幂,次方 """
""" x.pow(y[, z]) <==> pow(x, y[, z]) """
pass

def radd(self, y):
""" x.radd(y) <==> y+x """
pass

def rand(self, y):
""" x.rand(y) <==> y&x """
pass

def rdivmod(self, y):
""" x.rdivmod(y) <==> divmod(y, x) """
pass

def rdiv(self, y):
""" x.rdiv(y) <==> y/x """
pass

def repr(self):
"""转化为解释器可读取的形式 """
""" x.repr() <==> repr(x) """
pass

def str(self):
"""转换为人阅读的形式,如果没有适于人阅读的解释形式的话,则返回解释器课阅读的形式"""
""" x.str() <==> str(x) """
pass

def rfloordiv(self, y):
""" x.rfloordiv(y) <==> y//x """
pass

def rlshift(self, y):
""" x.rlshift(y) <==> y<<x """
pass

def rmod(self, y):
""" x.rmod(y) <==> y%x """
pass

def rmul(self, y):
""" x.rmul(y) <==> y*x """
pass

def ror(self, y):
""" x.ror(y) <==> y|x """
pass

def rpow(self, x, z=None):
""" y.rpow(x[, z]) <==> pow(x, y[, z]) """
pass

def rrshift(self, y):
""" x.rrshift(y) <==> y>>x """
pass

def rshift(self, y):
""" x.rshift(y) <==> x>>y """
pass

def rsub(self, y):
""" x.rsub(y) <==> y-x """
pass

def rtruediv(self, y):
""" x.rtruediv(y) <==> y/x """
pass

def rxor(self, y):
""" x.rxor(y) <==> y^x """
pass

def sub(self, y):
""" x.sub(y) <==> x-y """
pass

def truediv(self, y):
""" x.truediv(y) <==> x/y """
pass

def trunc(self, *args, **kwargs):
""" 返回数值被截取为整形的值,在整形中无意义 """
pass

def xor(self, y):
""" x.xor(y) <==> x^y """
pass

denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
""" 分母 = 1 """
"""the denominator of a rational number in lowest terms"""

imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
""" 虚数,无意义 """
"""the imaginary part of a complex number"""

numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
""" 分子 = 数字大小 """
"""the numerator of a rational number in lowest terms"""

real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
""" 实属,无意义 """
"""the real part of a complex number"""

posted @ 2017-05-31 11:39  xtrdb.net  阅读(201)  评论(0)    收藏  举报