Accueil
Rechercher:
sur developpez.com sur les forums
Forums | Tutoriels | F.A.Q's | Participez | Hébergement | Contacts
Accueil Conception Java DotNET Visual Basic  C  C++ Delphi Eclipse MS-Office SQL & SGBD Oracle  4D  Business Intelligence
Club Emploi Blogs   TV   Dév. Web PHP XML Python Autres 2D-3D-Jeux Sécurité Windows Linux PC Mac
FORUM PYTHON F.A.Q PYTHON TUTORIELS PYTHON SOURCES PYTHON OUTILS PYTHON LIVRES PYTHON
6.7.1 Mapping Operators to Functions


6.7.1 Mapping Operators to Functions

This table shows how abstract operations correspond to operator symbols in the Python syntax and the functions in the operator module.

Operation Syntax Function
Addition a + b add(a, b)
Concatenation seq1 + seq2 concat(seq1, seq2)
Containment Test o in seq contains(seq, o)
Division a / b div(a, b) # without __future__.division
Division a / b truediv(a, b) # with __future__.division
Division a // b floordiv(a, b)
Bitwise And a & b and_(a, b)
Bitwise Exclusive Or a ^ b xor(a, b)
Bitwise Inversion ~ a invert(a)
Bitwise Or a | b or_(a, b)
Exponentiation a ** b pow(a, b)
Identity a is b is_(a, b)
Identity a is not b is_not(a, b)
Indexed Assignment o[k] = v setitem(o, k, v)
Indexed Deletion del o[k] delitem(o, k)
Indexing o[k] getitem(o, k)
Left Shift a << b lshift(a, b)
Modulo a % b mod(a, b)
Multiplication a * b mul(a, b)
Negation (Arithmetic) - a neg(a)
Negation (Logical) not a not_(a)
Right Shift a >> b rshift(a, b)
Sequence Repitition seq * i repeat(seq, i)
Slice Assignment seq[i:j] = values setslice(seq, i, j, values)
Slice Deletion del seq[i:j] delslice(seq, i, j)
Slicing seq[i:j] getslice(seq, i, j)
String Formatting s % o mod(s, o)
Subtraction a - b sub(a, b)
Truth Test o truth(o)
Ordering a < b lt(a, b)
Ordering a <= b le(a, b)
Equality a == b eq(a, b)
Difference a != b ne(a, b)
Ordering a >= b ge(a, b)
Ordering a > b gt(a, b)

See About this document... for information on suggesting changes.
Responsable bénévole de la rubrique Python : Guillaume Duriaud - Contacter par EMail :
Vos questions techniques : forum d'entraide Python - Publiez vos articles, tutoriels et cours
et rejoignez-nous dans l'équipe de rédaction du club d'entraide des développeurs francophones
Nous contacter - Copyright © 2000-2008 www.developpez.com - Legal informations.