datalad icon indicating copy to clipboard operation
datalad copied to clipboard

`EnsureInt()` as parameter constraint sometimes too unspecific

Open mih opened this issue 3 years ago • 1 comments

Example: --recursion-limit uses EnsureInt, but likely would not be happy to receive a -234 as a value.

Given the ambiguity, a GUI input widget can also not infer an adequate input range.

mih avatar Sep 02 '22 11:09 mih

likely we want to add optional min and max attributes

yarikoptic avatar Sep 02 '22 12:09 yarikoptic

Well OP was correct, but also not well informed. The desired constraint is easily possible with built-in tools:

(EnsureInt() & EnsureRange(min=0)) | EnsureNone()

mih avatar Oct 06 '22 13:10 mih