函數語言程式設計模組¶
本章描述的模組提供了支援函數語言程式設計風格的函式和類,以及對可呼叫物件的一般操作。
本章中記錄了以下模組
itertools
— 用於高效迴圈的迭代器建立函式functools
— 高階函式和可呼叫物件的操作operator
— 作為函式的標準運算子lt()
le()
eq()
ne()
ge()
gt()
__lt__()
__le__()
__eq__()
__ne__()
__ge__()
__gt__()
not_()
__not__()
truth()
is_()
is_not()
abs()
__abs__()
add()
__add__()
and_()
__and__()
floordiv()
__floordiv__()
index()
__index__()
inv()
invert()
__inv__()
__invert__()
lshift()
__lshift__()
mod()
__mod__()
mul()
__mul__()
matmul()
__matmul__()
neg()
__neg__()
or_()
__or__()
pos()
__pos__()
pow()
__pow__()
rshift()
__rshift__()
sub()
__sub__()
truediv()
__truediv__()
xor()
__xor__()
concat()
__concat__()
contains()
__contains__()
countOf()
delitem()
__delitem__()
getitem()
__getitem__()
indexOf()
setitem()
__setitem__()
length_hint()
call()
__call__()
attrgetter()
itemgetter()
methodcaller()
- 將運算子對映到函式
- 原地運算子