[Chicago] I don't get why this works

Brantley Harris deadwisdom at gmail.com
Tue Apr 2 05:41:38 CEST 2013


Okay, then it should be a key error:

> a['a'] = a[a['a']]
KeyError: 'a'


On Mon, Apr 1, 2013 at 10:25 PM, Alex Gaynor <alex.gaynor at gmail.com> wrote:

> The assignments are going left to right.
>
> Alex
>
>
> On Mon, Apr 1, 2013 at 8:24 PM, Brantley Harris <deadwisdom at gmail.com>wrote:
>
>> > a = {}
>> > a['a'] = a[a['a']] = 'b'
>> {'a': 'b', 'b': 'b'}
>>
>> What the what?  I would think that should KeyError, but it runs fine.
>>  Someone splain.
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>>
>>
>
>
> --
> "I disapprove of what you say, but I will defend to the death your right
> to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
> "The people's good is the highest law." -- Cicero
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20130401/874866ca/attachment.html>


More information about the Chicago mailing list