Python 3.14 中的重大变化

4作者: wef6 个月前
Linux 如此成功的原因之一是 Torvalds 坚持从不破坏用户空间。<p>Python 开发者并不遵守这一原则,也许我需要放弃它,我真的受够了这种破事。<p>我们这些上了年纪的人都会记得 Python 2 到 3 的剧变。突然之间,生产代码需要进行大规模的重写。我们因此得到了一个可以说更好的 Python,但哦!那痛苦。<p>在 3.14 版本中,(除其他外)Python 开发者决定将 'forkserver' 设为 Process() 方法的默认值,而不是 'fork'(这用于启动子进程 - https://docs.python.org/3/library/multiprocessing.html)。 为什么要以这种肆无忌惮的方式破坏我们的代码? 为什么不保持默认设置不变呢——如果有人需要,总是可以选择使用 'forkserver'。 或者他们可以创建一个具有新行为的新的入口点,比如 Process_fastserver() 之类的? 哦不! 只是破坏它,让他们的客户疯狂地打补丁!<p>当我们采用一门语言时,我们希望今天运行的东西明天也能运行——我 30 年前编写的 C 和 bash 程序仍然可以运行。 但 Python 却不行——如果你使用它,请系好安全带,并确保你的回归测试足够彻底,这将是一段艰难的旅程。<p>慢慢行动,破坏一切,也许是这样?
查看原文
One of the reasons Linux is so successful is Torvald&#x27;s insistence on never breaking user space.<p>The python people don&#x27;t adhere to this principle and maybe I need to give up on it, I&#x27;m just sick of this crap.<p>Those of us of a certain vintage will recall the tumult of python-2 to -3. Suddenly, production code needed significant re-writing. We got an arguably better python out of it, but oh! the pain.<p>In 3.14, (among many other things) the python developers decided to make &#x27;forkserver&#x27; the default instead of &#x27;fork&#x27; for the Process() method (this is for starting a child process - https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;multiprocessing.html). Why on earth break our code in such a wanton way? Why not leave the default alone - there was always the option to use &#x27;forkserver&#x27; if one wanted it. Or maybe they could have created a new entrypoint with the new behaviour Process_fastserver() or some such? Oh no! Just break it and make their customers patch furiously!<p>When we adopt a language, we like to think that what runs today will run tomorrow - C and bash programs that I wrote 30 years ago still run. Not with python - if you use it, buckle up and make sure your regression tests are thorough, it&#x27;ll be a rough ride.<p>Move slow and break things, perhaps?