datajoint-matlab icon indicating copy to clipboard operation
datajoint-matlab copied to clipboard

Replace the `|` operator with `dj.OrList`

Open dimitri-yatsenko opened this issue 7 years ago • 5 comments

The | operator is currently used to construct or-lists for restrictions but it is limited to restrictions by relations. In datajoint-python, we implement the explicit dj.OrList object. I propose to match the matlab implementation and deprecate the | operator.

dimitri-yatsenko avatar Mar 17 '17 16:03 dimitri-yatsenko

What would be a reason not to support either syntax? Use of | sounds intuitive compared to having to use dj.OrList.

eywalker avatar Apr 13 '17 03:04 eywalker

The | operator only works for objects of classes that we define and is therefore limited. dj.OrList works for any types of restrictors. If dj.OrList works, then i would rather have one correct way of doing something.

dimitri-yatsenko avatar Apr 13 '17 04:04 dimitri-yatsenko

Do we support something like restricting by a cell array?

eywalker avatar Apr 13 '17 06:04 eywalker

Yes, an OrList is any list. So what we really need is an AndList so that

r & a & b & c

can be expressed as

r & dj.AndList({a b c})

dimitri-yatsenko avatar Apr 17 '17 17:04 dimitri-yatsenko

should be implemented with #96

ixcat avatar Apr 28 '20 20:04 ixcat