Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Astroid 4.2.0b5 documentation
Astroid 4.2.0b5 documentation
  • Inference Introduction
  • Extending astroid syntax tree
  • API
    • General API
    • Nodes
      • AnnAssign
      • Arguments
      • Assert
      • Assign
      • AssignAttr
      • AssignName
      • AsyncFor
      • AsyncFunctionDef
      • AsyncWith
      • Attribute
      • AugAssign
      • Await
      • BinOp
      • BoolOp
      • Break
      • Call
      • ClassDef
      • Compare
      • Comprehension
      • Const
      • Continue
      • Decorators
      • DelAttr
      • DelName
      • Delete
      • Dict
      • DictComp
      • DictUnpack
      • EmptyNode
      • EvaluatedObject
      • ExceptHandler
      • Expr
      • For
      • FormattedValue
      • FunctionDef
      • GeneratorExp
      • Global
      • If
      • IfExp
      • Import
      • ImportFrom
      • Interpolation
      • JoinedStr
      • Keyword
      • Lambda
      • List
      • ListComp
      • Match
      • MatchAs
      • MatchCase
      • MatchClass
      • MatchMapping
      • MatchOr
      • MatchSequence
      • MatchSingleton
      • MatchStar
      • MatchValue
      • Module
      • Name
      • NamedExpr
      • Nonlocal
      • ParamSpec
      • Pass
      • Raise
      • Return
      • Set
      • SetComp
      • Slice
      • Starred
      • Subscript
      • TemplateStr
      • Try
      • TryStar
      • Tuple
      • TypeAlias
      • TypeVar
      • TypeVarTuple
      • UnaryOp
      • Unknown
      • While
      • With
      • Yield
      • YieldFrom
      • Position
      • AsStringVisitor
    • Base Nodes
      • BaseContainer
      • ComprehensionScope
      • LocalsDictNodeNG
      • NodeNG
      • Pattern
    • Proxies
      • Proxy
      • Generator
      • AsyncGenerator
      • UnionType
    • Objects
      • FrozenSet
      • Super
      • DictInstance
      • DictItems
      • DictKeys
      • DictValues
      • PartialFunction
      • Property
    • Inference results
      • UninferableBase
      • BadOperationMessage
      • BadUnaryOperationMessage
      • BadBinaryOperationMessage
    • Exceptions
    • Inference context
      • InferenceContext
      • CallContext
    • Manager
      • AstroidManager
    • Object models
      • ObjectModel
      • ModuleModel
      • FunctionModel
      • ClassModel
      • SuperModel
      • UnboundMethodModel
      • BoundMethodModel
      • ContextManagerModel
      • GeneratorBaseModel
      • GeneratorModel
      • AsyncGeneratorModel
      • InstanceModel
      • ExceptionInstanceModel
      • DictModel
      • PropertyModel
    • Typing
      • InferFn
      • TransformFn
      • InferenceErrorInfo
      • AstroidManagerBrain
  • What’s New in astroid
    • astroid’s ChangeLog

Indices

  • Index
  • Module Index
Back to top
View this page

UnionType¶

class astroid.bases.UnionType(left: UnionType | ClassDef | Const, right: UnionType | ClassDef | Const, parent: NodeNG | None = None)[source]¶

Bases: BaseInstance

Special node representing new style typing unions.

Proxied class is set once for all in raw_building.

bool_value(context: InferenceContext | None = None) → Literal[True][source]¶
callable() → Literal[False][source]¶
display_type() → str[source]¶
pytype() → Literal['types.UnionType'][source]¶
Next
Objects
Previous
AsyncGenerator
Copyright © 2003-2026, Logilab, and astroid contributors
Made with Sphinx and @pradyunsg's Furo
On this page
  • UnionType
    • UnionType
      • UnionType.bool_value()
      • UnionType.callable()
      • UnionType.display_type()
      • UnionType.pytype()