On 6/3/2017 12:38 PM, Thomas Jollans wrote:

>> I'd like to suggest an explanation of what a sequence is
>> that doesn't use the word 'object' because an object has
>> a specific meaning in Python.
>>
>> Am I on the right track here?
>
> No, strings don't internally store the characters as objects, and yes,
> the slicing operation creates objects. However, strings *are* sequences,
> sequences *are* ordered collections of objects.

I don't see how both can be true. "Object" has a clear meaning in
Python, and the contents of a sequence don't meet the requirements,
as I understand them.

If there were some way of measuring the number of objects in
a program, then it would be easy to prove (or disprove) my hypothesis.
In other words this program

a = "abc"

would have the same number of objects as this program

a = "abcdefghijklmnopqrstuvwzyz"

> The sentence "A sequence is an ordered collection of objects" means that
> a sequence has (ordered) elements, you can access these elements, and
> when you do that, you will get an object (seeing as everything is an
> object).

The distinction between an "object" and "element" is key here. (This
might be seen as pedantic, but I think it's important to be clear,
especially in a book intended for beginners, as I am.

> Hope this helps.

Thanks for taking the time to reply. I'm somebody who reads technical
books *very* carefully so the distinction between objects and elements
is important to me.

Cordially,
Jon Forrest

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

Reply via email to