On Tue, Mar 28, 2017 at 2:24 PM, Markus Meskanen <markusmeska...@gmail.com> wrote: > While I agree with most of your arguments, surely you must be the one joking > here? "Ugly" is obviously a matter of opinion, I personally find the > proposed syntax more beautiful than the // used in many other languages. But > claiming it's bad because people would mix it up with raw strings and people > not realizing is nonsense. Not only does it look very different, but > attempting to call match() or any other regex method on it would surely give > out a reasonable error: > > AttributeError: 'str' object has no attribute 'match' > > Which _in the worst case scenario_ results into googling where the top rated > StackOverflow question clearly explains the difference between r'' and re''
Yes, but if the "in" operator is used, it would still work, because r"..." is a str, and "str" in "string" is meaningful. 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. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/