Definite or indefinite article for non-singletons?

Marko Rauhamaa marko at pacujo.net
Sun Jul 28 03:32:26 EDT 2019


Ethan Furman <ethan at stoneleaf.us>:

> On 07/27/2019 02:10 PM, Chris Angelico wrote:
>> When talking about indistinguishable objects, is it correct to talk
>> about "the <x>" or "an <x>"?
>
> Multiple indistinguishable objects are still multiple, so "an".
>
> Implementation details should only enter the conversation when
> specifically discussing the implementation -- so CPython is an
> implementation detail while Python is the language.

Yes. If the API guarantees singleton-ness (reliable testability through
"is"), the correct article is "the", otherwise "an".

There is no guarantee that two empty strings are the same object so "an
empty string" is the right expression.

Now, len(string) return "the length" of the string of "a length" of the
string:

   >>> s = "*"*2000
   >>> len(s)
   2000
   >>> len(s) is len(s)
   False

Here "the length" is the right answer and must be understood as a
contraction of the pedantic: "an integer representing the length".

So it depends on the context if the relevant equivalence is "is" or
"==". Maybe the rule of thumb is that if we are talking about strings,
integers and similar things, we should think about it from the point of
view of Python's data model (objects; "is"). But when we talk about
things like "length", "square root", "sum" or "name", the point of view
is the abstractions the objects are standing for ("==").


Marko



More information about the Python-list mailing list