On this page
ast.BitOr
Prev: ast.BitAnd | Up: ast | Next: ast.compare
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.BitOr
Tags: #public #python3 #stdlib #ast
Import
import ast
from ast import BitOr
Signature & Overview
ast.BitOr(...)
BitOr
Usage
import ast
node = ast.parse("int | str", mode="eval").body
assert isinstance(node, ast.BinOp) and isinstance(node.op, ast.BitOr)
Gotchas
- Bitwise
|AND PEP 604 union types (int | str): Both parse asBinOp(op=BitOr()).
REPL Inspect
from ast import BitOr
help(BitOr)
Linked from
Related notes
- tuts/python3/stdlib_module/ast/BitAnd Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/compare Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/Add Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/alias Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/And Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AnnAssign Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AST Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ast/arg shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/arguments shared tags: #ast, #stdlib