4 ms·
Oh yes, that Python code looks so idiomatic: https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-2.html https://benchmarksga
by zmmmmm 5y ago
Oh yes, that Python code looks so idiomatic:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-2.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- viraptor 5y agoregex=PCRE2.pcre2_compile_8(pattern, c_size_t(len(pattern)), c_uint32(0), byref(c_int()), byref(c_size_t()), None) As far as FFI goes, I would say this looks amazingly simple.
- pmontra 5y agoCan't comment on that but why are these people putting spaces after commas (correct) and not to the left and right of the assignment sign = ? It's so weird to read a=b
- oefrha 5y agoThat’s very straightforward translation of C code using pcre to Python using ctypes. It doesn’t look great because the ugliness isn’t wrapped in a library. But Python ctypes definitely isn’t hard to use. It is unsafe as hell though.
- igouy 5y agoAlternatively see Python #1 https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-1.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...