why this code giving recursion error????
נתי שטרן
nsh531 at gmail.com
Sun Jun 26 06:56:27 EDT 2022
and i ask also what's the problem with this function:
def _code(p, flags):
flags = p.state.flags | flags
code = []
# compile info block
sre_compile._compile_info(code, p, flags)
# compile the pattern
sre_compile._compile(code, p.data, flags)
code.append(SUCCESS)
return code
בתאריך יום א׳, 26 ביוני 2022 ב-13:48 מאת נתי שטרן <nsh531 at gmail.com>:
> def compile(p, flags=0):
> # internal: convert pattern list to internal format
>
> if (isinstance(p,str)):
> pattern = p
> p = sre_parse.parse(p, flags)
> else:
> pattern = None
>
> code = _code(p, flags)
>
> if flags & SRE_FLAG_DEBUG:
> print()
> dis(code)
>
> # map in either direction
> groupindex = p.state.groupdict
> indexgroup = [None] * p.state.groups
> for k, i in groupindex.items():
> indexgroup[i] = k
>
> return sre_compile.compile(
> pattern, flags | p.state.flags, code,
> p.state.groups-1,
> groupindex, tuple(indexgroup)
> )
>
>
> --
> <https://netanel.ml>
>
--
<https://netanel.ml>
More information about the Python-list
mailing list