* Chris Angelico <ros...@gmail.com> [2017-03-28 16:37:16 +1100]: > But I think a better solution will be for regex literals to be > syntax-highlighted differently. If they're a truly-supported syntactic > feature, they can be made visually different in your editor, making > the distinction blatantly obvious. > > That said, though, I'm -1 on this. Currently, every prefix letter has > its own meaning, and broadly speaking, combining them combines their > meanings. An re"..." literal should be a raw "e-string", whatever that > is, so I would expect that e"..." is the same kind of thing but with > different backslash handling.
First, I would like to state that the "module-static" version of regexp functions, avoiding the compile step, are a great idea. (e.g. : mo = re.search(r'.k', mystring) ) The str integrated one also, but maybe confusing, which regexp lib is used ? (must be the default one). Then, re"" being two letters looks like a real problem. Lets pick one amongs the 22 remaining free alphabet letters. What about : - g"", x"" (like in regex) ? - m"" (like shawn for Perl, meaming Match ?) - q"" (for Query ?) - k"" (in memory of Stephen Cole Kleene ? https://en.wikipedia.org/wiki/Regular_expression) - /"" (to be half the way toward /regexp/ syntax) - ~"" ?"" (other symbols, I avoid regexp-starting symbols, would be ugly in real usage) And what about an approach with flag firsts ? (or where to put them ?) : i"" (regexp with ignorecase flag on) AILMSX"" (regexp with all flags on) It would consume a lot of letters, but would use it for a good reason :-) Personnally, I think a JavaScript-like syntaxe would be great, and I feel it as asking too much… : - it would naturally be highlihted differently ; - it would not be the first (happy) similarity (https://hackernoon.com/javascript-vs-python-in-2017-d31efbb641b4#.ky9it5hph) - its a working integration, including flag matters. -- Simon Descarpentries +336 769 702 53 http://s.d12s.fr _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/