On Sun, Feb 23, 2020 at 01:28:35AM -0000, Steve Jorgensen wrote:

> Another issue is one of consistency.  A string is not a sequence of 
> length-1 strings.

Isn't it? It sure looks like a sequence of length-1 (sub)strings to me.

Of course, strings can also be views as a sequence of paragraphs, lines, 
words, or any other sort of substring you like. Hypertalk allowed you to 
read strings in arbitrarily nested "chunks":

    get the last character of the first word of the third line of text

with similar syntax for writing and iteration. One might argue that 
there's nothing particularly useful about characters, and treating 
strings as sequences of words, lines etc could be more useful. But I 
don't think we can argue that strings aren't sequences of 
substrings, including characters.


> The length-1 strings created by iterating are more 
> like slices than members.

They certainly aren't members (attributes). You can't access a 
particular substring using dot notation:

    # Give me the first char in the string
    c = string.0  # Syntax error.

So substrings aren't attributes/members. What would you name them? The 
same applies to lists and other sequences as well.



-- 
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XFG4ALS5ANOHUMCYTKEPIY3CYXUG7VJJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to