long :: Class long
[hide private]
[frames] | no frames]

Class long

object --+
         |
        long

long(x=0) -> long long(x, base=10) -> long

Convert a number or string to a long integer, or return 0L if no arguments are given. If x is floating point, the conversion truncates towards zero.

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) 4L

Instance Methods [hide private]
 
__abs__(x)
abs(x)
 
__add__(x, y)
x+y
 
__and__(x, y)
x&y
 
__cmp__(x, y)
cmp(x,y)
 
__coerce__(x, y)
coerce(x, y)
 
__div__(x, y)
x/y
 
__divmod__(x, y)
divmod(x, y)
 
__float__(x)
float(x)
 
__floordiv__(x, y)
x//y
 
__format__(...)
default object formatter
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__getnewargs__(...)
 
__hash__(x)
hash(x)
 
__hex__(x)
hex(x)
 
__index__(...)
x[y:z] <==> x[y.__index__():z.__index__()]
 
__int__(x)
int(x)
 
__invert__(x)
~x
 
__long__(x)
long(x)
 
__lshift__(x, y)
x<<y
 
__mod__(x, y)
x%y
 
__mul__(x, y)
x*y
 
__neg__(x)
-x
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__nonzero__(x)
x != 0
 
__oct__(x)
oct(x)
 
__or__(x, y)
x|y
 
__pos__(x)
+x
 
__pow__(x, y, z=...)
pow(x, y[, z])
 
__radd__(x, y)
y+x
 
__rand__(x, y)
y&x
 
__rdiv__(x, y)
y/x
 
__rdivmod__(x, y)
divmod(y, x)
 
__repr__(x)
repr(x)
 
__rfloordiv__(x, y)
y//x
 
__rlshift__(x, y)
y<<x
 
__rmod__(x, y)
y%x
 
__rmul__(x, y)
y*x
 
__ror__(x, y)
y|x
 
__rpow__(y, x, z=...)
pow(x, y[, z])
 
__rrshift__(x, y)
y>>x
 
__rshift__(x, y)
x>>y
 
__rsub__(x, y)
y-x
 
__rtruediv__(x, y)
y/x
 
__rxor__(x, y)
y^x
int
__sizeof__()
Returns size in memory, in bytes
 
__str__(x)
str(x)
 
__sub__(x, y)
x-y
 
__truediv__(x, y)
x/y
 
__trunc__(...)
Truncating an Integral returns itself.
 
__xor__(x, y)
x^y
int or long
bit_length(long)
Number of bits necessary to represent self in binary.
 
conjugate(...)
Returns self, the complex conjugate of any long.

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Properties [hide private]
  denominator
the denominator of a rational number in lowest terms
  imag
the imaginary part of a complex number
  numerator
the numerator of a rational number in lowest terms
  real
the real part of a complex number

Inherited from object: __class__

Method Details [hide private]

__format__(...)

 

default object formatter

Overrides: object.__format__
(inherited documentation)

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

__hash__(x)
(Hashing function)

 

hash(x)

Overrides: object.__hash__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__sizeof__()

 

Returns size in memory, in bytes

Returns: int
Overrides: object.__sizeof__

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: object.__str__

bit_length(long)

 

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

Returns: int or long