Skip to content

binary ops between a scalar Group and LArray silently fails #797

@gdementen

Description

@gdementen

I consider this very high priority because it silently gives wrong results.

>>> time = Axis('time=2015..2019')
>>> time.i[0]
time.i[0]
>>> int(time.i[0])
2015
>>> # with a scalar, it works as expected
... time.i[0] + 1
2016
>>> arr = ndtest(3)
>>> arr
>>> time.i[0] + arr
a  a0  a1  a2
    0   1   2
>>> arr + time.i[0]
a  a0  a1  a2
    0   1   2
>>> # using int() is an easy workaround but since this is a silent failure, you don't know you have to use it.
>>> int(time.i[0]) + arr
a    a0    a1    a2
   2015  2016  2017

BTW: this is important because looping on an axis (e.g. for y in time) gives you scalar Groups.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions