|
|
|
|
|
by another-dave
1229 days ago
|
|
> Think it this way: you're going to split the conditions into two: `users` is non-empty, which is the "good" condition; and `users` is empty, which is the "bad" condition. In a lot of cases though, an empty collection isn't a "bad" condition at all, e.g. it's a valid collection to apply filters/maps to. Similarly when people get used to doing "if not i" for ints, but then forget about the times that zero is a valid value. It's true that dynamic coercion is a feature of the language, but coding conventions generally are often about enforcing "least surprise" to remove a burden from the person reading the code. |
|
Then you don't need to check if it's empty to begin with.