Python 3.14 中的重大变更

4作者: wef大约 9 小时前原帖
Linux之所以如此成功的原因之一,是托瓦尔兹(Torvalds)坚持不破坏用户空间。 而Python的开发者们并没有遵循这一原则,也许我该放弃这个想法,我实在是厌倦了这种情况。 我们这一代人会记得从Python 2到3的动荡。突然间,生产代码需要进行大量重写。虽然我们从中得到了一个可以说更好的Python,但哦!那种痛苦真是难以忍受。 在3.14版本中,Python开发者决定将Process()方法的默认值从“fork”改为“forkserver”(这是用于启动子进程的 - 详细信息请参见:https://docs.python.org/3/library/multiprocessing.html)。为什么要以如此肆意的方式破坏我们的代码呢?为什么不保持默认设置不变——如果有人想使用“forkserver”,总是可以选择的。或者他们可以创建一个新的入口点,采用新的行为,比如Process_fastserver()之类的?哦不!就这样破坏它,让他们的用户拼命修补! 当我们采用一种语言时,我们希望今天能运行的代码明天也能运行——我30年前写的C和bash程序至今仍能运行。但Python就不一样了——如果你使用它,准备好并确保你的回归测试非常彻底,这将是一段艰难的旅程。 也许是慢慢来,破坏一些东西?
查看原文
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?