datajoint / datajoint-matlab

Relational data pipelines for the science lab
MIT License
42 stars 38 forks source link

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

Open dimitri-yatsenko opened 7 years ago

dimitri-yatsenko commented 7 years ago

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.

eywalker commented 7 years ago

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

dimitri-yatsenko commented 7 years ago

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.

eywalker commented 7 years ago

Do we support something like restricting by a cell array?

dimitri-yatsenko commented 7 years ago

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})
ixcat commented 4 years ago

should be implemented with #96