[Chicago] I don't get why this works

Alex Gaynor alex.gaynor at gmail.com
Tue Apr 2 05:25:55 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20130401/da34c830/attachment-0001.html>


More information about the Chicago mailing list