Dennis Lee Bieber wrote:

> Where's the line form to split those who'd prefer the first vs the
> second result in this sample <G>:
> 
>>>> unExpected = "What about a string"
>>>> firstToLast = unExpected[:]
>>>> repr(firstToLast)
> "'What about a string'"
>>>> explicitList = list(unExpected)
>>>> repr(explicitList)
> "['W', 'h', 'a', 't', ' ', 'a', 'b', 'o', 'u', 't', ' ', 'a', ' ', 's',
> 't', 'r', 'i', 'n', 'g']"
>>>> 

Well, as things stand, there's a way to get whichever result you need.  The 
`list` constructor builds a single list from a single iterable.  The list 
literal enclosed by `[`, `]` makes a list containing a bunch of items.

Strings being iterable introduces a wrinkle, but `list('abcde')` doesn't 
create `['abcde']` just as `list(1)` doesn't create `[1]`.

        Mel.

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

Reply via email to