On Mon, 2 Sep 2019 at 07:04, Pasha Stetsenko <stpa...@gmail.com> wrote:
> > Don't say that this proposal won't be abused. Every one of the OP's > > motivating examples is an abuse of the syntax, returning non-strings > > from something that looks like a string. > > If you strongly believe that if something looks like a string it ought to > quack like a string too, then we can consider 2 potential remedies: > > 1. Change the delimiter, for example use curly braces: `re{abc}`. This > would still be parseable, since currently an id cannot be followed by a set > or a dict. (The forward-slash, on the other hand, will be ambiguous). > > 2. We can also leave the quotation marks as delimiters. Once this feature > is implemented, the IDEs will update their parsers, and will be emitting a > token of "user-defined literal" type. Simply setting the color for this > token to something different than your preferred color for strings will > make it visually clear that those tokens aren't strings. Hence, no > possibility for confusion. > Just to add my 2 cents: there are always two sides in each language proposal: more flexibility/usability, and more language complexity. These need to be compared and the comparison is hard because it is often subjective. FWIW, I think in this case the added complexity outweighs the benefits. I think only the very widely used literals (like numbers) deserve their own syntax. For everything else it is fine to have few extra keystrokes. -- Ivan
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GD2AAFCB262JSSFZVOMUM6EXPTFJHZ4F/ Code of Conduct: http://python.org/psf/codeofconduct/