[Python-ideas] iterable.__unpack__ method

MRAB python at mrabarnett.plus.com
Tue Feb 26 01:19:54 CET 2013


On 2013-02-26 00:07, Steven D'Aprano wrote:
> On 26/02/13 10:30, Greg Ewing wrote:
>> Devin Jeanpierre wrote:
>>> On Mon, Feb 25, 2013 at 7:45 AM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
>>>>    a, b, *() = iterable
>>>
>>> Of course, you can't unpack anything into (), because Python never had
>>> that syntax, but you get the idea.
>>
>> -1, this is just as arbitrary as ... or a lone *.
>>
>> I prefer ... myself, because visually it has a low profile
>> and doesn't draw undue attention to something that you're
>> saying you don't care about.
>>
>> Maybe ... could be blessed as an official "don't care"
>> assignment target, like _ in Haskell. That would make this
>> usage less of a special case (although it would still be
>> partially special, since it suppresses unpacking of the
>> rest of the iterator).
>
> Please no. _ is already overloaded too much. In i18n contexts, _ is
> conventionally used as the function for getting display text. In the
> interactive interpreter, _ is used for the last result. And in source
> code, _ is often used by convention as a "don't care" variable.
>
[snip]
He didn't say that we should use "_", he said that "..." would be like
"_" in Haskell.




More information about the Python-ideas mailing list