<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>On Jun 2, 2015, at 18:50, Bruce Leban <<a href="mailto:bruce@leban.us">bruce@leban.us</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 2, 2015 at 12:03 PM, Andrew Barnert via Python-ideas <span dir="ltr"><<a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2tx" class="" style="overflow:hidden">Any number or string token followed by a name (identifier) token is currently illegal. This would change so that, if there's no whitespace between them, it's legal, and equivalent to a call to a function named `literal_{name}({number-or-string})`. For example, `1.2d` becomes `literal_d('1.2')`, `1.2_dec` becomes `literal_dec('1.2')`, `"1.2"d` also becomes `literal_d('1.2')`.<br>
<br>
Of course `0x12decimal` becomes `literal_imal('0x12dec')`, and `21jump` becomes `literal_ump('21j'), which are not at all useful, and potentially confusing, but I don't think that would be a serious problem in practice.<br></div></blockquote></div><br>You seem to suggest that the token should start with an underscore when you write 1.2_dec and  {...}_o but not when you write 1.2d and 1.2jump. </div></div></div></blockquote><div><br></div><div>Well, I was suggesting leaving it up to the user who defines the literals. Sure, it's possible to come up with confusing suffixes, but if we can trust end users to name a variable that holds an XML tree "root" instead "_12rawbytes", can't we trust library authors to name their suffixes appropriately? I think you will _often_ want the preceding underscore, at least for multi-character suffixes, and you will _almost never_ want multiple underscores, or strings of underscores and digits without letters, etc. But that seems more like something for PEP8 and other style guides and checkers than something the language would need to enforce.</div><div><br></div><div>However, I noticed that I left off the extra underscore in literal__dec, and it really does look pretty ugly that way, so... Maybe you have a point here.</div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">I do think the namescape thing is an issue but requiring me to write</div><div class="gmail_extra"><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><font face="monospace, monospace">from literals import literal_jump</font></div></blockquote><div class="gmail_extra"><br></div><div class="gmail_extra">isn't necessarily that bad. Without an explicit import, how would I go about tracking down what exactly 21_jump means?</div></div></div></blockquote><div><br></div><div>Thanks; that's the argument I was trying to make and not making very well.</div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">The use of _o on a dict is strange since the thing you're attaching it to isn't a literal. I think there needs to be some more thought here if you want to apply it to anything other than a simple value:</div></div></div></blockquote><div><br></div><div>At least two people suggested that it's better to just explicitly put that whole question of collection "literals" off for the future (assuming the basic idea of numeric and string literal suffixes  is worth considering at all), and I think they're right. </div></body></html>