我应该怎么称呼符号“|”?管道或位运算符
What should I call the symbol “|”?A pipe or bit operator
请看以下内容:
def update_page_info(url):
# fetch_page -> parse_page -> store_page
chain = fetch_page.s(url) | parse_page.s() | store_page_info.s(url)
chain()
@app.task()
def fetch_page(url):
return myhttplib.get(url)
@app.task()
def parse_page(page):
return myparser.parse_document(page)
@app.task(ignore_result=True)
def store_page_info(info, url):
PageInfo.objects.create(url=url, info=info)
你有一个管道字符(更准确的说法是vertical bar character), which when used in an expression is called a binary bitwise operator:
The |
operator yields the bitwise (inclusive) OR of its arguments, which must be integers.
运算符可通过 __or__
special method, which is what SQLAlchemy uses to build queries, as seen in your example code (in contrast to the boolean or
operator 连接,由于其短路行为而无法连接。
请看以下内容:
def update_page_info(url):
# fetch_page -> parse_page -> store_page
chain = fetch_page.s(url) | parse_page.s() | store_page_info.s(url)
chain()
@app.task()
def fetch_page(url):
return myhttplib.get(url)
@app.task()
def parse_page(page):
return myparser.parse_document(page)
@app.task(ignore_result=True)
def store_page_info(info, url):
PageInfo.objects.create(url=url, info=info)
你有一个管道字符(更准确的说法是vertical bar character), which when used in an expression is called a binary bitwise operator:
The
|
operator yields the bitwise (inclusive) OR of its arguments, which must be integers.
运算符可通过 __or__
special method, which is what SQLAlchemy uses to build queries, as seen in your example code (in contrast to the boolean or
operator 连接,由于其短路行为而无法连接。