A container having 2 or more elements could be called a “plural container”. A container with no elements could be called an “empty container”.
But what is the terminology for a container whose current size is exactly 1 element?
I would use the term “unary” but that refers to operators that take exactly 1 argument.
The reason I would like a term for this is that I am writing a boolean method to check if two data structures are both of size exactly one and I want a good name for the method. Currently I have:
def length_is_1(self, x, y):
return len(x) == 1 and len(y) == 1
Go to Source
Author: Terrence Brannon