V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
anzu

Python 正则表达式,系列套娃

  •  
  •   anzu · Aug 24, 2019 · 1826 views
    This topic created in 2443 days ago, the information mentioned may be changed or developed.
    我最初也注意到了不同的写法,但没细究,一直用更简单的 re.search 或 re.match 作小而短的正则匹配。直到刚才看到套娃文章,好像这种讨论方式在前端比较流行:

    Python 正则表达式,请不要再用 re.compile 了!!!
    https://zhuanlan.zhihu.com/p/70680488

    驳 《 Python 正则表达式,请不要再用 re.compile 了!!!》
    https://zhuanlan.zhihu.com/p/78265675

    回《驳 <Python 正则表达式,请不要再用 re.compile 了!!!>》
    https://zhuanlan.zhihu.com/p/78628786

    回《回《驳 <Python 正则表达式,请不要再用 re.compile 了!!!>》》 Part1
    https://zhuanlan.zhihu.com/p/78630410

    回《回《驳 <Python 正则表达式,请不要再用 re.compile 了!!!>》》 Part2
    https://zhuanlan.zhihu.com/p/78653548
    3 replies    2019-08-26 09:37:11 +08:00
    ipwx
        1
    ipwx  
       Aug 24, 2019 via Android
    这个宣称不要用 re.compile 的,十足的杠精
    zzj0311
        2
    zzj0311  
       Aug 25, 2019 via Android
    这玩意的意义更多的是为了提高可读性吧,语言怎么实现和你怎么写好代码本质上没啥关系
    no1xsyzy
        3
    no1xsyzy  
       Aug 26, 2019
    第三篇有个一眼就能发现的错误:“如果抱着写代码要语言无关,要通用而故意放弃了一些语言特性,那为什么不直接写 1010 ?”
    抱歉,不同 CPU 不一样的,语言特性更强而不是更弱。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   829 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 19:15 · PVG 03:15 · LAX 12:15 · JFK 15:15
    ♥ Do have faith in what you're doing.