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

Rename data generators from plural to singular #1

Closed
jariji opened this issue Feb 24, 2024 · 1 comment
Closed

Rename data generators from plural to singular #1

jariji opened this issue Feb 24, 2024 · 1 comment

Comments

@jariji
Copy link
Contributor

jariji commented Feb 24, 2024

My pet peeve about hypothesis.py is that it uses the plural booleans() to generate a single boolean. I think it is easier to understand that a single draw from a generator generates one instance of the thing. For example

function f(ints)
  sum(ints)
end

f takes a thing called ints which is supposed to be passed a sequence of integers. But Data.Integers() will pass it a single integer. I think this is confusing and it would be easier to understand if the way to generate one integer were Integer() and, if needed, a shortcut to generate multiple integers were Integers().

A counterargument is that it's more natural for map and filter to work on things that are named pural.

@Seelengrab
Copy link
Owner

The plural is intentional, since any given generator can generate multiple different instances. The plural also helps prevent punning the existing names like Vector, Dict and so on, preventing a situation where someone attempts to do using Supposition.Data: Vector immediately introducing a name clash with Base.

@jariji jariji closed this as completed Feb 24, 2024
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

2 participants