<p dir="ltr">Another such example, since names are just names:</p>
<p dir="ltr"> dict = {"a": 2}<br>
print(dict["a"]) # 2</p>
<p dir="ltr">Overwriting a built in type name is bad, but entirely possible. </p>
<p dir="ltr">dict["a"] here is also confusing with dict[str]. This kind of use could also potentially throw off a type linter too. </p>
<p dir="ltr">These probably aren't the best examples out there, but I can definitely see this operator's meaning becoming very confused as more people start to apply it in different ways. </p>
<p dir="ltr">We should not be just using something because it's there. Especially if it causes other problems. <br>
list[str] may be valid syntax in old Python 3 versions, but it's still not going to be correct if used in those versions. You're going to get some breakage no matter what.</p>
<p dir="ltr">This feature is very new to Python as a whole, why not give it a syntax that provides a proper separation from what already was?</p>
<p dir="ltr">Sunjay</p>
<div class="gmail_quote">On Aug 15, 2014 3:14 PM, "Łukasz Langa" <<a href="mailto:lukasz@langa.pl">lukasz@langa.pl</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">On Aug 15, 2014, at 12:06 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>> wrote:<br><div><br><blockquote type="cite">On 08/15/2014 11:56 AM, Ryan Hiebert wrote:<br>
<blockquote type="cite"><br>Getting an item from a class has no meaning for any classes that I’ve ever used, and I haven’t come up with any hypothetical one that would want to do that.<br></blockquote><br>--> class Foo(Enum):<br>
... spam = 'meat flavored'<br>... eggs = 'chicken by-product'<br>...<br>--> Foo<br><enum 'Foo'><br><br>--> Foo['spam']<br><Foo.spam: 'meat flavored’><br></blockquote>
<div><br></div><div>I also thought of enums. Looks fairly innocent to me, though. Do you see any cases where the two would conflict?</div></div><div><br></div><div><div><div style="font-family:'Lucida Grande';text-align:-webkit-auto;word-wrap:break-word">
-- <br>Best regards,<br>Łukasz Langa<br><br>WWW: <a href="http://lukasz.langa.pl/" target="_blank">http://lukasz.langa.pl/</a><br>Twitter: @llanga<br>IRC: ambv on #python-dev</div></div><br><div></div></div></div><br>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br></blockquote></div>