<div dir="ltr">Yeah, basically this was a fork in the road roughly 25 years ago that Python didn't take. (I was aware of the idea from Lisp, and decided Python could do with just strings instead.) There's no way adding something like this today will suddenly change everything else that is part of having "symbols"; the proposed feature would be lacking the integration with the internals that makes it work well in some other languages.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 21, 2015 at 1:13 AM, Andrew Barnert <span dir="ltr"><<a href="mailto:abarnert@yahoo.com.dmarc.invalid" target="_blank">abarnert@yahoo.com.dmarc.invalid</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="h5"><div>On Jan 20, 2015, at 23:48, Stephen Hansen <<a href="mailto:me+python@ixokai.io" target="_blank">me+python@ixokai.io</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><b><font face="arial, helvetica, sans-serif">What do people do now?</font></b></div><div style="font-family:monospace,monospace"><span style="font-family:arial,helvetica,sans-serif">or strings</span><br></div><div style="font-family:monospace,monospace"><br></div><div style="font-family:monospace,monospace">df.sort('name')</div><div style="font-family:monospace,monospace"><span style="font-family:arial,helvetica,sans-serif"></span></div></div></div></div></blockquote><div><br></div><div>...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div style="font-family:monospace,monospace"><span style="font-family:arial,helvetica,sans-serif">strings work but feel unpleasant</span></div></div></div></div></blockquote><div><br></div><div>Why?</div><div><br></div><div>What does :foo get you that 'foo' doesn't?</div><div><br></div><div>One character being saved doesn't seem like a good reason to add syntax.</div></div></div></div>
</div></blockquote><div><br></div></div></div><span>Mainly they're used to fill in gaps where a language isn't dynamic enough to just use strings, which Python doesn't need.</span><div><span><br></span></div><div><span>(Sometimes this is claimed to be a strength rather than a weakness. </span><span>Arguably, using auto-interned symbols instead of strings for things like attribute or global lookup could be more efficient, but I don't think languages like Ruby have shown any demonstrable gain. And we just had a thread from someone who considered it a "bug" that Python allows setattr(spam, '3', 3) when 3 isn't a valid identifier, which symbols "fix" automatically. But even if these were real advantages, </span><span>Python obviously isn't going to make such a radical change as banning strings for dynamic access.)</span></div><div><div><span><br></span></div><div><span>A language can also add things on top of the symbol/string distinction (besides auto-interning)--e.g., you can add syntactic sugar for dynamic lookup ("foo.:bar" means "getattr(foo, bar)"), or </span><span>make undefined variables have the value of their symbol so you can LBYL test them, or all kinds of other things--but again, they're all things I don't think Python wants or needs.</span></div><div><div><br></div><div><div><div><div><div>And without a vague idea for why Python would want to do any of the things that other languages do with their symbol-vs.-string distinctions, this really does seem to come down to just saving one character.</div></div></div></div></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><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>