Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix functions in validator class with is_ #159

Closed
eonu opened this issue Jan 24, 2021 · 1 comment
Closed

Prefix functions in validator class with is_ #159

eonu opened this issue Jan 24, 2021 · 1 comment

Comments

@eonu
Copy link
Owner

eonu commented Jan 24, 2021

As a big Ruby fan, I miss the way you can tell a function returns a boolean if it ends with a question mark (e.g. 1.even?).

With the _Validator class, instead of having:

self._val = _Validator()
self._val.restricted_float(...)
self._val.func(...)
self._val.iterable(...)
self._val.fitted(...)

It would be clearer if we prefixed these functions with is_ to make it clear that they are performing some check (though not necessarily returning a boolean like the Ruby ?):

self._val = _Validator()
self._val.is_restricted_float(...)
self._val.is_func(...)
self._val.is_iterable(...)
self._val.is_fitted(...)

Also a more appropriate name for func would be callable.

@eonu
Copy link
Owner Author

eonu commented Jan 24, 2021

Implemented in #161.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant