meaning of: line, =

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Feb 5 18:30:39 EST 2015


Devin Jeanpierre wrote:
> On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico <rosuav at gmail.com> wrote:
> 
>>On Thu, Feb 5, 2015 at 4:36 AM, Peter Otten <__peter__ at web.de> wrote:
>>
>>>>>>>[result] = f()
>>>>>>result
>>
>>Huh, was not aware of that alternate syntax.
> 
> Nor are most people. Nor is Python, in some places -- it seems like
> people forgot about it when writing some bits of the grammar.

If I remember correctly, it's left over from long ago
when you had to use tuple syntax to unpack tuples and
list syntax to unpack lists (and you couldn't unpack
anything else).

When the iterator protocol was introduced, the two
became equivalent.

-- 
Greg



More information about the Python-list mailing list