Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « builtins »

Classe « int »

Informations générales

Héritage

builtins.object
    builtins.int

Définition

class int(builtins.object):

Description [extrait de int.__doc__]

int([x]) -> integer
int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments
are given.  If x is a number, return x.__int__().  For floating point
numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string,
bytes, or bytearray instance 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)
4

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
denominator<attribute 'denominator' of 'int' objects>
imag<attribute 'imag' of 'int' objects>
numerator<attribute 'numerator' of 'int' objects>
real<attribute 'real' of 'int' objects>

Liste des opérateurs

Signature de l'opérateur Description
__add__(self, value) Return self+value. [extrait de __add__.__doc__]
__and__(self, value) Return self&value. [extrait de __and__.__doc__]
__eq__(self, value) Return self==value. [extrait de __eq__.__doc__]
__floordiv__(self, value) Return self//value. [extrait de __floordiv__.__doc__]
__ge__(self, value) Return self>=value. [extrait de __ge__.__doc__]
__gt__(self, value) Return self>value. [extrait de __gt__.__doc__]
__invert__(self) ~self [extrait de __invert__.__doc__]
__le__(self, value) Return self<=value. [extrait de __le__.__doc__]
__lshift__(self, value) Return self<<value. [extrait de __lshift__.__doc__]
__lt__(self, value) Return self<value. [extrait de __lt__.__doc__]
__mod__(self, value) Return self%value. [extrait de __mod__.__doc__]
__mul__(self, value) Return self*value. [extrait de __mul__.__doc__]
__ne__(self, value) Return self!=value. [extrait de __ne__.__doc__]
__neg__(self) -self [extrait de __neg__.__doc__]
__or__(self, value) Return self|value. [extrait de __or__.__doc__]
__pos__(self) +self [extrait de __pos__.__doc__]
__pow__(self, value, mod=None) Return pow(self, value, mod). [extrait de __pow__.__doc__]
__radd__(self, value) Return value+self. [extrait de __radd__.__doc__]
__rand__(self, value) Return value&self. [extrait de __rand__.__doc__]
__rfloordiv__(self, value) Return value//self. [extrait de __rfloordiv__.__doc__]
__rlshift__(self, value) Return value<<self. [extrait de __rlshift__.__doc__]
__rmod__(self, value) Return value%self. [extrait de __rmod__.__doc__]
__rmul__(self, value) Return value*self. [extrait de __rmul__.__doc__]
__ror__(self, value) Return value|self. [extrait de __ror__.__doc__]
__rpow__(self, value, mod=None) Return pow(value, self, mod). [extrait de __rpow__.__doc__]
__rrshift__(self, value) Return value>>self. [extrait de __rrshift__.__doc__]
__rshift__(self, value) Return self>>value. [extrait de __rshift__.__doc__]
__rsub__(self, value) Return value-self. [extrait de __rsub__.__doc__]
__rtruediv__(self, value) Return value/self. [extrait de __rtruediv__.__doc__]
__rxor__(self, value) Return value^self. [extrait de __rxor__.__doc__]
__sub__(self, value) Return self-value. [extrait de __sub__.__doc__]
__truediv__(self, value) Return self/value. [extrait de __truediv__.__doc__]
__xor__(self, value) Return self^value. [extrait de __xor__.__doc__]

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__abs__(self) abs(self) [extrait de __abs__.__doc__]
__bool__(self) self != 0 [extrait de __bool__.__doc__]
__ceil__ Ceiling of an Integral returns itself. [extrait de __ceil__.__doc__]
__divmod__(self, value) Return divmod(self, value). [extrait de __divmod__.__doc__]
__float__(self) float(self) [extrait de __float__.__doc__]
__floor__ Flooring an Integral returns itself. [extrait de __floor__.__doc__]
__format__(self, format_spec)
__getattribute__(self, name) Return getattr(self, name). [extrait de __getattribute__.__doc__]
__getnewargs__(self)
__hash__(self) Return hash(self). [extrait de __hash__.__doc__]
__index__(self) Return self converted to an integer, if self is suitable for use as an index into a list. [extrait de __index__.__doc__]
__int__(self) int(self) [extrait de __int__.__doc__]
__rdivmod__(self, value) Return divmod(value, self). [extrait de __rdivmod__.__doc__]
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__round__ Rounding an Integral returns itself. [extrait de __round__.__doc__]
__sizeof__(self) Returns size in memory, in bytes. [extrait de __sizeof__.__doc__]
__trunc__ Truncating an Integral returns itself. [extrait de __trunc__.__doc__]
as_integer_ratio(self) Return integer ratio. [extrait de as_integer_ratio.__doc__]
bit_length(self) Number of bits necessary to represent self in binary. [extrait de bit_length.__doc__]
conjugate Returns self, the complex conjugate of any int. [extrait de conjugate.__doc__]
from_bytes(bytes, byteorder, *, signed=False) Return the integer represented by the given array of bytes. [extrait de from_bytes.__doc__]
to_bytes(self, /, length, byteorder, *, signed=False) Return an array of bytes representing an integer. [extrait de to_bytes.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__