Python operator Compute module

Source: Internet
Author: User
Tags mul pow

This module provides a series of function operations. For example, Operator.add (x, y) equals x+y


A = [A]
b = [5,6,7]
c = Map (operator.Mul, A, B)
The value of C is [5, 12, 21]

ABS (...)
ABS (a)--same as ABS (a).

Add (...)
Add (A, b)--Same as a + B.

And_ (...)
And_ (A, b)--Same as A & B.

Concat (...)
Concat (A, b)--Same as a + B, for A and B sequences.

Contains (...)
Contains (A, b)--Same as B in a (note reversed operands).

Countof (...)
Countof (A, b)--Return the number of times B occurs in a.

Delitem (...)
Delitem (A, b)--same as Del A[b].

Delslice (...)
Delslice (A, B, c)--same as Del A[b:c].

Div (...)
Div (A, b)--Same as A/b when __future__.division are not in effect.

EQ (...)
EQ (A, b)--Same as a==b.

Floordiv (...)
Floordiv (A, b)--Same as A//b.

GE (...)
GE (A, b)--Same as a>=b.

GetItem (...)
GetItem (A, b)--same as a[b].

Getslice (...)
Getslice (A, B, c)--same as A[B:C].

GT (...)
GT (A, B)--Same as a>b.

Iadd (...)
Iadd (A, b)--same as a + = B.

Iand (...)
Iand (A, b)--Same as a &= B.

Iconcat (...)
Iconcat (A, b)--same as a + = B, for A and B sequences.

Idiv (...)
Idiv (A, b)--Same as a/= B when __future__.division are not in effect.

Ifloordiv (...)
Ifloordiv (A, b)--Same as a//= B.

Ilshift (...)
Ilshift (A, b)--Same as a <<= B.

Imod (...)
Imod (A, b)--Same as a%= B.

IMul(...)
IMul(A, B)--Same as a *= B.
Index (...)
Index (a)--same as a.__index__ ()

IndexOf (...)
IndexOf (A, b)--Return The first index of B in a.

INV (...)
INV (a)--same as ~a.

Invert (...)
Invert (a)--same as ~a.

IOR (...)
IOR (A, b)--Same as a |= B.

Ipow (...)
Ipow (A, b)--Same as a **= B.

Irepeat (...)
Irepeat (A, b)--Same as a *= B, where A is a sequence, and B are an integer.

Irshift (...)
Irshift (A, b)--Same as a >>= B.

Iscallable (...)
Iscallable (a)--same as callable (a).

Ismappingtype (...)
Ismappingtype (a)--Return True If A has a mapping type, False otherwise.

Isnumbertype (...)
Isnumbertype (a)--Return True If A has a numeric type, False otherwise.

Issequencetype (...)
Issequencetype (a)--Return True If A has a sequence type, False otherwise.

Is_ (...)
Is_ (A, b)--Same as a is B.
Is_not (...)
Is_not (A, b)--same as a is not B.

Isub (...)
Isub (A, b)--same as a-= B.

Itruediv (...)
Itruediv (A, b)--Same as a/= B when __future__.division are in effect.

Ixor (...)
Ixor (A, b)--Same as a ^= B.

Le (...)
Le (A, b)--Same as a<=b.

LShift (...)
LShift (A, b)--Same as a << B.

Lt (...)
Lt (A, B)--Same as a<b.

MoD (...)
MoD (A, b)--same as a% B.

Mul(...)
Mul(A, B)--Same as a * b.

NE (...)
NE (A, b)--Same as a!=b.

Neg (...)
Neg (a)--same as-a.

Not_ (...)
Not_ (a)--same as not a.

Or_ (...)
Or_ (A, b)--Same as a | B.
POS (...)
POS (a)--same as +a.

Pow (...)
Pow (A, b)--Same as a * * b.

Repeat (...)
Repeat (A, b)--Return A * b, where A is a sequence, and B are an integer.

Rshift (...)
Rshift (A, b)--Same as a >> B.

Sequenceincludes (...)
Sequenceincludes (A, b)--Same as B in a (note reversed operands; deprecated).

SetItem (...)
SetItem (A, B, c)--same as a[b] = c.

Setslice (...)
Setslice (A, B, C, D)--same as a[b:c] = d.

Sub (...)
Sub (A, b)--same as a-a.

Truediv (...)
Truediv (A, b)--Same as A/b when __future__.division are in effect.

Truth (...)
Truth (a)--Return True if A is true, False otherwise.

XOR (...)
XOR (A, b)--Same as a ^ B.


This article is from the "Expect batch Sync data" blog, so be sure to keep this source http://4249964.blog.51cto.com/4239964/1550534

Python operator Compute module

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.