<div>I just want to chip in that, as far as syntactic sugar go, `somedict:foo` looks better than `somedict..foo`.<br clear="all"></div><div><br></div><div>2c...</div><br clear="all">~/santa<br>
<br><br><div class="gmail_quote">On Thu, Mar 24, 2011 at 4:40 AM, Jameson Quinn <span dir="ltr">&lt;<a href="mailto:jameson.quinn@gmail.com">jameson.quinn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

&quot;class attrdict&quot; is a perennial dead-end for intermediate pythonistas who want to save 3 characters/5 keystrokes for item access. Other languages such as javascript allow &quot;somedict.foo&quot; to mean the same as &quot;somedict[&#39;foo&#39;]&quot;, so why not python? Well, there are a number of reasons why not, beginning with all the magic method names in python.<div>



<br></div><div>But saving keystrokes is still a reasonable goal.</div><div><br></div><div>So what about a compromise? Allow &quot;somedict..foo&quot;, with two dots, to take that place. It still saves 2 characters (often 4 keystrokes; and I find even &#39;, &quot;[&quot;, or &quot;]&quot; harder to type than &quot;.&quot;).</div>



<div><br></div><div>The &quot;foo&quot; part would of course have to obey attribute/identifier naming rules. So there would be no shortcut for &quot;somedict[&#39;$#!%&#39;]&quot;. But for any identifier-legal foo, the interpreter would just read ..foo as [&#39;foo&#39;].</div>



<div><br></div><div>I would not be surprised if I&#39;m not the first person to suggest this. If so, and there&#39;s already well-known reasons why this is a bad idea, I apologize. But if the only reason not to is &quot;we never did it that way before&quot; or &quot;it would be too addictive, and so people would never want to use older python versions&quot; or &quot;headache for tools like pylint&quot;, I think we should do it.</div>



<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/santoso.wijaya%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/santoso.wijaya%40gmail.com</a><br>
<br></blockquote></div><br>