On Fri, Dec 28, 2018 at 1:56 AM Ma Lin wrote:
> Maybe this literal will encourage people to finish tasks using regex,
> even lead to abuse regex, will this change Python's style?
>
> What's worse is, people using mixed manners in the same project:
>
> one_line.split(',')
> ...
> p','.split(one_li
On Mon, Dec 31, 2018 at 12:48:56AM -0800, Yuval Greenfield wrote:
> In my opinion, only if this change would make 50% of programs run 50%
> faster then it might be worth discussing.
What if it were 100% of programs 25% faster? *wink*
Generally speaking, we don't introduce new syntax as a speed
On Thu, 27 Dec 2018 19:48:40 +0800
Ma Lin wrote:
> We can use this literal to represent a compiled pattern, for example:
>
> >>> p"(?i)[a-z]".findall("a1B2c3")
> ['a', 'B', 'c']
>
> >>> compiled = p"(?<=abc)def"
> >>> m = compiled.search('abcdef')
> >>> m.group(0)
> 'def'
>
> >>> rp'\W
Le 31/12/2018 à 12:31, M.-A. Lemburg a écrit :
>
> We already have re.search() and re.match() which deal with compilation
> on-the-fly and caching. Perhaps the documentation should hint at this
> more explicitly...
The complaint is that the global cache is still too costly.
See measurements in h
On 31.12.2018 12:23, Antoine Pitrou wrote:
> On Thu, 27 Dec 2018 19:48:40 +0800
> Ma Lin wrote:
>> We can use this literal to represent a compiled pattern, for example:
>>
>> >>> p"(?i)[a-z]".findall("a1B2c3")
>> ['a', 'B', 'c']
>>
>> >>> compiled = p"(?<=abc)def"
>> >>> m = compiled.search('
>regex = re.compile(r"...")
>regex = p("...")
>
> is not that much different.
True, but when the literal is put somewhere far from the compile() call it
becomes a problem for static analysis. Conceptually a regex is not a string but
an embedded foreign language. That's why I think thi
On 18-12-31 19:47, Antoine Pitrou wrote:
> The complaint is that the global cache is still too costly.
> See measurements in https://bugs.python.org/issue35559
In this issue, using a global variable `_has_non_base16_digits` [1] will
accelerate 30%.
Is re module's internal cache [2] so bad?
If