Expressions

eval(expression)

Evaluate a Hail expression, returning the result.

Expression

Base class for Hail expressions.

ArrayExpression

Expression of type tarray.

ArrayNumericExpression

Expression of type tarray with a numeric type.

BooleanExpression

Expression of type tbool.

CallExpression

Expression of type tcall.

CollectionExpression

Expression of type tarray or tset

DictExpression

Expression of type tdict.

IntervalExpression

Expression of type tinterval.

LocusExpression

Expression of type tlocus.

NumericExpression

Expression of numeric type.

Int32Expression

Expression of type tint32.

Int64Expression

Expression of type tint64.

Float32Expression

Expression of type tfloat32.

Float64Expression

Expression of type tfloat64.

SetExpression

Expression of type tset.

StringExpression

Expression of type tstr.

StructExpression

Expression of type tstruct.

TupleExpression

Expression of type ttuple.

NDArrayExpression

Expression of type tndarray.

NDArrayNumericExpression

Expression of type tndarray with a numeric element type.

hail.expr.eval(expression)[source]

Evaluate a Hail expression, returning the result.

This method is extremely useful for learning about Hail expressions and understanding how to compose them.

The expression must have no indices, but can refer to the globals of a Table or MatrixTable.

Examples

Evaluate a conditional:

>>> x = 6
>>> hl.eval(hl.if_else(x % 2 == 0, 'Even', 'Odd'))
'Even'
Parameters:

expression (Expression) – Any expression, or a Python value that can be implicitly interpreted as an expression.

Returns:

Any