[Python-ideas] Allow function to return multiple values
Abe Dillon
abedillon at gmail.com
Fri Jun 9 11:15:28 EDT 2017
No. You're right. I don't know why I thought strings were treated
differently.
On Jun 9, 2017 7:47 AM, "Mark E. Haase" <mehaase at gmail.com> wrote:
> On Thu, Jun 8, 2017 at 4:27 PM, Abe Dillon <abedillon at gmail.com> wrote:
>
>> >>> a, *b = 1, 2, 3, 4, 5 # NOTE: Most itterables unpack starred
>> variables as a list
>> >>> type(b)
>> <class 'list'>
>>
>> >>> a, *b = "except strings"
>> >>> type(b)
>> <class 'str'>
>>
>
> I was just playing around with this, and on Python 3.5.3, I see strings
> unpacked as lists:
>
> >>> first, *rest = 'spam'
> >>> type(rest)
> <class 'list'>
>
> Am I doing something different, or is this something that changed in the
> language?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170609/30b4ad12/attachment.html>
More information about the Python-ideas
mailing list