On 7/27/2019 5:10 PM, Chris Angelico wrote:
When talking about indistinguishable objects, is it correct to talk
about "the <x>" or "an <x>"?

Example:

def f(s):
     """Frob a thing.

     If s is an empty string, frobs all the things.
     OR
     If s is the empty string, frobs all the things.
     """

Depends on whether one is using 'is' in the Python sense of object identify or the natural language sense of value equality. To evade, avoid the (an?) article.

If string s is empty,...

I think we tend to be clearer about numbers.

x is an instance of 3.14.
x is a float equal to 3.14.
x is the number 3.14.
x is the float 3.14.

It's entirely possible that a Python implementation will optimize
small strings and thus have exactly one empty string, but it's also
entirely possible to have multiple indistinguishable empty strings.
Grammatically, is it better to think of empty strings as an entire
category of object, and you were passed one from that category ("an
empty string"), or to think of zero-length instances of 'str' as being
implementation details referring to the one and only Platonic "empty
string"?

Does it make a difference to usage if the object is mutable? For
instance, would you say "the empty string" but "an empty set"?

In mathematics, *every* set is 'the'.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to