← Back to team overview

ufl team mailing list archive

Slightly confusing behaviour change

 

This shouldn't affect users, but here's a slightly confusing behaviour that
has to be this way.

Comparing a UFL scalar value to a python scalar value will compare the
values using standard python rules:

In [3]: as_ufl(1) == 1
Out[3]: True

In [4]: as_ufl(1) == 1.0
Out[4]: True

In [5]: as_ufl(1.0) == 1.0
Out[5]: True

In [6]: as_ufl(1.0) == 1
Out[6]: True

Comparing two UFL scalar values will include their type:

In [7]: as_ufl(1.0) == as_ufl(1)
Out[7]: False

Martin