[Python-ideas] Add regex pattern literal p""

Ma Lin malincns at 163.com
Fri Dec 28 21:42:13 EST 2018


On 18-12-28 22:54, Joao S. O. Bueno wrote:
> Sorry for sounding over-reactive, but yes, this could make Python look
> like Perl.
Yes, this may introduce Perl's style irreversibly, we need to be 
cautious about this.

I'm thinking, if people ask these questions in their mind when reading a 
piece of Python code:
1, "Is this Python code?"
2, "What's the purpose of this code?"
3, "How can I modify it if I want to ... ?"
Maybe Python is on a doubtful way.

There is an interesting question: Will literal p"" ruin Python's (or 
other dynamic languages like Ruby) style? Why will this happen?
> And a 3rd shortcoming - flags can't be passed as parameters, and have
> to be built-in the regexp themselves, further complicating the readability even
> for very simple regular expressions.
IMO this is an advantage, it's hard to omit flags when reading/copying 
an regex pattern.




More information about the Python-ideas mailing list