On 2019-07-29 00:04, Chris Angelico wrote:
On Sun, Jul 28, 2019 at 5:36 PM Marko Rauhamaa <ma...@pacujo.net> wrote:
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 ("==").
Interesting. So in your view, a string object representing zero
characters is "an", but its length is "the"? I'd have thought that
both are considered value types, where identity is immaterial.
There can be multiple empty strings, which the implementation _might_
optimise to a singleton, but each string has only one length.
A string of length > 1 has multiple characters, each being _a_
character, but the string as a whole has only one length, so we can call
it _the_ length.
Thanks for all the insights, all. This is a curious point of English
and one that I've definitely seen people on both sides of.
My apologies for not responding earlier or to individual posts. For a
while (and I'm actually not certain that this post will make it), all
Gmail addresses have been unable to post to python-list, and even
contacting the list-owner wasn't possible.
--
https://mail.python.org/mailman/listinfo/python-list