Is An Element of a Sequence an Object?

Jon Forrest nobozo at gmail.com
Sun Jun 4 00:06:19 EDT 2017


On 6/3/2017 5:03 PM, Ben Finney wrote:
> Jon Forrest <nobozo at gmail.com> writes:
> 
>> I'm learning about Python. A book I'm reading about it
> 
> Can you say which book, and where in the book it says this?

With all due respect, I'd rather not. The author has been very
responsive when I raised this issue, and I don't want to make
him look bad.

> To phrase it that way might be slightly misleading, though. It is *not*
> true, for example, to say that the characters in the string already
> exist as objects.

That's exactly what I was thinking, and why I raised the issue.

> I think, rather, that you may have an incorrect understanding of a
> sequence. The objects produced by an operation on a sequence – a slice,
> or iterating the sequence – do not necessarily exist as distinct objects
> before that operation.

I wasn't thinking so much about the objects produced by an operation
on a sequence as I was about when the sequence is created. A trivial
sequence is

"abc"

As I understand it, this is one object, not three. The original excerpt
implies the later.

Jon





More information about the Python-list mailing list