Python 3的反驳

Zed Shaw, of Learn Python the Hard Way fame, has now written The Case Against Python 3.

努力学习Python的成名者Zed Shaw现在撰写了The Case Against Python 3

I’m not involved with core Python development. The only skin I have in this game is that I like Python 3. It’s a good language. And one of the big factors I’ve seen slowing its adoption is that respected people in the Python community keep grouching about it. I’ve had multiple newcomers tell me they have the impression that Python 3 is some kind of unusable disaster, though they don’t know exactly why; it’s just something they hear from people who sound like they know what they’re talking about. Then they actually use the language, and it’s fine.

我没有参与Python的核心开发。 我在这个游戏中唯一的皮肤是我喜欢Python 3 。 这是一门好语言。 我所见过的阻碍其普及的一大因素是,Python社区中受人尊敬的人们一直对此表示不满。 我有很多新人告诉我,他们给人的印象是Python 3是某种无法使用的灾难,尽管他们不知道为什么。 这只是他们从听起来像他们知道自己在说什么的人们听到的东西。 然后他们实际使用该语言,就可以了。

I’m sad to see the Python community needlessly sabotage itself, but Zed’s contribution is beyond the pale. It’s not just making a big deal about changed details that won’t affect most beginners; it’s complete and utter nonsense, on a platform aimed at people who can’t yet recognize it as nonsense. I am so mad.

我很伤心看到Python社区不必​​要的破坏本身,而是捷思锐的贡献是踏破铁鞋。 这不仅仅是在细节上做出了很多改变,这些改变不会影响大多数初学者。 在针对尚未意识到其胡说八道的人们的平台上,它是完整且完全胡说八道的。 我好生气

I give two sets of reasons as I see them now. One for total beginners, and another for people who are more knowledgeable about programming.

我现在给出两个理由。 一个面向总体初学者,另一个面向更了解编程的人。

Just to note: the two sets of reasons are largely the same ideas presented differently, so I’ll just weave them together below.


The first section attempts to explain the case against starting with Python 3 in non-technical terms so a beginner can make up their own mind without being influenced by propaganda or social pressure.

第一部分试图以非技术性的角度来解释反对使用Python 3的案例,以便初学者可以下定决心而不受宣传或社会压力的影响。

Having already read through this once, this sentence really stands out to me. The author of a book many beginners read to learn Python in the first place is providing a number of reasons (some outright fabricated) not to use Python 3, often in terms beginners are ill-equipped to evaluate, but believes this is a defense against propaganda or social pressure.

读完这句话,这句话对我来说确实很突出。 许多初学者读过这本书的作者最初都是为了学习Python而提出的,这提供了许多不使用Python 3的原因(有些是完全捏造的),通常是因为初学者没有足够的能力进行评估,但他认为这是对防御Python的一种防御宣传或社会压力。

Before getting into the main technical reasons I would like to discuss the one most important social reason for why you should not use Python 3 as a beginner:

在探讨主要技术原因之前,我想讨论一个为什么您不应该将Python 3用作初学者的最重要的社会原因:


一个 概率 Python 3 这样故障 杀死 Python

Python 3’s adoption is really only at about 30% whenever there is an attempt to measure it.

每当尝试对其进行衡量时,Python 3的采用率实际上只有大约30%。

Wait, really? Wow, that’s fantastic.

等等,真的吗? 哇,好极了。

I mean, it would probably be higher if the most popular beginner resources were actually teaching Python 3, but you know.

我的意思是,如果最受欢迎的初学者资源实际上在教授Python 3,则可能更高,但是您知道。

Nobody is all that interested in finding out what the real complete adoption is, despite there being fairly simple ways to gather metrics on the adoption.


This accusatory sentence conspicuously neglects to mention what these fairly simple ways are, a pattern that repeats throughout. The trouble is that it’s hard to even define what “adoption” means — I write all my code in Python 3 now, but veekun is still Python 2 because it’s in maintenance mode, so what does that say about adoption? You could look at PyPI download stats, but those are thrown way off by caches and system package managers. You could look at downloads from the Python website, but a great deal of Python is written and used on Unix-likes, where Python itself is either bundled or installed from the package manager.

这个控告性的句子明显地忽略了这些相当简单的方式是什么,这种模式在整个过程中都是重复的。 麻烦在于,甚至很难定义“采用”的含义-我现在用Python 3编写所有代码,但是veekun仍然是Python 2,因为它处于维护模式,那么这对采用表示了什么呢? 您可以查看PyPI下载统计信息,但是缓存和系统软件包管理器会丢弃这些统计信息。 您可以查看从Python网站下载的内容,但是大量的Python是在类Unix上编写和使用的,其中Python本身是捆绑包或从程序包管理器安装。

It’s as simple as that. If you learn Python 2, then you can still work with all the legacy Python 2 code in existence until Python dies or you (hopefully) move on. But if you learn Python 3 then your future is very uncertain. You could really be learning a dead language and end up having to learn Python 2 anyway.

就这么简单。 如果您学习Python 2,那么您仍然可以使用现有的所有旧Python 2代码,直到Python死掉或您(希望)继续前进。 但是,如果您学习Python 3,那么您的前途将非常不确定。 您可能真的是在学习一门枯燥的语言,最终还是不得不学习Python 2。

You could use Python 2, until it dies… or you could use Python 3, which might die. What a choice.

您可以使用Python 2,直到它死掉为止;或者您可以使用Python 3,它可能会死掉。 真是个选择。

By some definitions, Python 2 is already dead — it will not see another major release, only security fixes. Python 3 is still actively developed, and its seventh major release is next month. It even contains a new feature that Zed later mentions he prefers to Python 2’s offerings.

根据一些定义,Python 2已经死了-它不会看到另一个主要版本,而只会看到安全修复程序。 Python 3仍在积极开发中,其第七个主要发行版本是下个月。 它甚至包含一个新功能,Zed稍后提到,他喜欢Python 2的产品。

It may shock you to learn that I know both Python 2 and Python 3. Amazingly, two versions of the same language are much more similar than they are different. If you learned Python 3 and then a wizard cast a spell that made it vanish from the face of the earth, you’d just have to spend half an hour reading up on what had changed from Python 2.

得知我同时了解Python 2和Python 3,您可能会感到震惊。令人惊讶的是,同一种语言的两个版本之间的相似之处远胜于不同之处。 如果您学习了Python 3,然后又有一个巫师施放了一个使它从地球上消失的咒语,那么您只需要花半个小时的时间来阅读一下Python 2的变化。

Also, it’s been over a decade, maybe even multiple decades, and Python 3 still isn’t above about 30% in adoption. Even among the sciences where Python 3 is touted as a “success” it’s still only around 25-30% adoption. After that long it’s time to admit defeat and come up with a new plan.

而且,已经过去了十年,甚至可能是几十年,Python 3的采用率仍未超过30%。 即使在Python 3被吹捧为“成功”的科学中,它的采用率仍然只有约25-30%。 漫长的时间过后,该承认失败并提出新计划了。

Python 3.0 came out in 2008. The first couple releases ironed out some compatibility and API problems, so it didn’t start to gain much traction until Python 3.2 came out in 2011. Hell, Python 2.0 came out in 2000, so even Python 2 isn’t multiple decades old. It would be great if this trusted beginner reference could take two seconds to check details like this before using them to scaremonger.

Python 3.0于2008年问世。第一批发行版解决了一些兼容性和API问题,因此直到2011年Python 3.2推出之时,它才开始受到关注。Python2.0在2000年问世,甚至Python 2已有数十年历史了。 如果这个值得信赖的初学者参考可能需要两秒钟时间来检查类似的细节,然后再使用它们来吓scar,那就太好了。

The big early problem was library compatibility: it’s hard to justify switching to a new version of the language if none of the libraries work. Libraries could only port once their own dependencies had ported, of course, and it took a couple years to figure out the best way to maintain compatibility with both Python 2 and Python 3. I’d say we only really hit critical mass a few years ago — for instance, Django didn’t support Python 3 until 2013 — in which case that 30% is nothing to sneeze at.

早期的最大问题是库兼容性:如果没有一个库起作用,则很难证明切换到该语言的新版本是合理的。 当然,只有移植了自己的依赖项之后,库才可以移植,并且花了几年的时间才找到保持与Python 2和Python 3的兼容性的最佳方法。我要说,我们几年才真正达到临界点以前-例如,Django直到2013年才支持Python 3-在这种情况下,有30%的优势可不容小。

There are more reasons beyond just the uncertain future of Python 3 even decades later.

甚至数十年后,除了Python 3的不确定未来之外,还有更多原因。

In one paragraph, we’ve gone from “maybe even multiple decades” to just “decades”, which is a funny way to spell “eight years”.


The Python project’s efforts to convince you to start with Python 3 are not in your best interest, but, rather, are only in the best interests of the Python project.

Python项目说服您开始使用Python 3的工作并不符合您的最大利益,而只是符合Python项目的最大利益。

It’s bad, you see, for the Python project to want people to use the work it produced.


Anyway, please buy Zed Shaw’s book.

无论如何,请购买Zed Shaw的书。

Anyway, please pledge to my Patreon.


Ultimately though, if Python 3 were good they wouldn’t need to do any convincing to get you to use it. It would just naturally work for you and you wouldn’t have any problems. Instead, there are serious issues with Python 3 for beginners, and rather than fix those issues the Python project uses propaganda, social pressure, and marketing to convince you to use it. In the world of technology using marketing and propaganda is immediately a sign that the technology is defective in some obvious way.

但是,最终,如果Python 3很好,他们将不需要任何说服力就可以使用它。 它自然会为您工作,并且您不会有任何问题。 相反,Python 3对于初学者来说存在严重的问题,而不是解决这些问题,而Python项目使用宣传,社会压力和市场营销来说服您使用它。 在使用营销和宣传的技术领域,这立即表明该技术以某种明显的方式存在缺陷。

This use of social pressure and propaganda to convince you to use Python 3 despite its problems, in an attempt to benefit the Python project, is morally unconscionable to me.

尽管有问题,但使用社会压力和宣传来说服您使用Python 3来使Python项目受益,这在道德上对我而言是不合理的。

Ten paragraphs in, Zed is telling me that I should be suspicious of anything that relies on marketing and propaganda. Meanwhile, there has yet to be a single concrete reason why Python 3 is bad for beginners — just several flat-out incorrect assertions and a lot of handwaving about how inexplicably nefarious the Python core developers are. You know, the same people who made Python 2. But they weren’t evil then, I guess.

Zed在十段中告诉我,我应该对任何依赖于营销和宣传的事情表示怀疑。 同时,Python 3对初学者不利的原因还没有一个具体的原因-只是一些毫无用处的错误断言,还有很多关于Python核心开发人员多么恶毒的想法。 您知道,制作Python 2的人是同一个人。但是,我猜他们当时并不邪恶。

In the programming language theory there is this basic requirement that, given a “complete” programming language, I can run any other programming language. In the world of Java I’m able to run Ruby, Java, C++, C, and Lua all at the same time. In the world of Microsoft I can run F#, C#, C++, and Python all at the same time. This isn’t just a theoretical thing. There is solid math behind it. Math that is truly the foundation of computer science.

在编程语言理论中,有一个基本要求,即给定“完整”的编程语言,我可以运行任何其他编程语言。 在Java的世界中,我能够同时运行Ruby,Java,C ++,C和Lua。 在Microsoft的世界中,我可以同时运行F#,C#,C ++和Python。 这不仅仅是理论上的事情。 它背后有扎实的数学运算。 数学确实是计算机科学的基础。

The fact that you can’t run Python 2 and Python 3 at the same time is purely a social and technical decision that the Python project made with no basis in mathematical reality. This means you are working with a purposefully broken platform when you use Python 3, and I personally can’t condone teaching people to use something that is fundamentally broken.

您不能同时运行Python 2和Python 3的事实纯粹是Python项目在数学现实中没有基础的社会和技术决策。 这意味着当您使用Python 3时,您正在使用一个故意破坏的平台,而我个人不能容忍教导人们使用从根本上破坏的东西。

The programmer-oriented section makes clear that the solid math being referred to is Turing-completeness — the section is even titled “Python 3 Is Not Turing Complete”.

面向程序员的部分明确指出,所指的可靠数学是图灵完备性-该部分甚至标题为“ Python 3 Not Turing Complete”。

First, notice a rhetorical trick here. You can run Ruby, Java, C++, etc. at the same time, so why not Python 2 and Python 3?

首先,请注意此处的修辞技巧。 您可以同时运行Ruby,Java,C ++等,那么为什么不使用Python 2和Python 3呢?

But can you run Java and C# at the same time? (I’m sure someone has done this, but it’s certainly much less popular than something like Jython or IronPython.)

但是,您可以同时运行Java和C#吗? (我敢肯定有人这样做了,但是它肯定不比Jython或IronPython之类的流行。)

Can you run Ruby 1.8 and Ruby 2.3 at the same time? Ah, no, so I guess Ruby 2.3 is fundamentally and purposefully broken.

您可以同时运行Ruby 1.8和Ruby 2.3吗? 啊,不,所以我想Ruby 2.3从根本上是有目的的。

Can you run Lua 5.1 and 5.3 at the same time? Lua is a spectacular example, because Lua 5.2 made a breaking change to how the details of scope work, and it’s led to a situation where a lot of programs that embed Lua haven’t bothered upgrading from Lua 5.1. Was Lua 5.2 some kind of dark plot to deliberately break the language? No, it’s just slightly more inconvenient than expected for people to upgrade.

您可以同时运行Lua 5.1和5.3吗? Lua是一个引人注目的例子,因为Lua 5.2对范围细节的工作方式进行了重大更改,并导致许多嵌入Lua的程序没有费心地从Lua 5.1升级。 Lua 5.2是某种暗中故意破坏语言的情节吗? 不,对于人们进行升级而言,这比预期的要麻烦一些。

Anyway, as for Turing machines:


In computer science a fundamental law is that if I have one Turing Machine I can build any other Turing Machine. If I have COBOL then I can bootstrap a compiler for FORTRAN (as disgusting as that might be). If I have FORTH, then I can build an interpreter for Ruby. This also applies to bytecodes for CPUs. If I have a Turing Complete bytecode then I can create a compiler for any language. The rule then can be extended even further to say that if I cannot create another Turing Machine in your language, then your language cannot be Turing Complete. If I can’t use your language to write a compiler or interpreter for any other language then your language is not Turing Complete.

在计算机科学中,一条基本法则是,如果我拥有一台图灵机,则可以制造任何其他图灵机。 如果我有COBOL,则可以为FORTRAN引导一个编译器(可能令人厌恶)。 如果我有FORTH ,那么我可以为Ruby构建一个解释器。 这也适用于CPU的字节码。 如果我有一个图灵完成字节码,那么我可以为任何语言创建一个编译器。 然后,该规则可以进一步扩展为:如果我不能用您的语言创建另一台图灵机,那么您的语言就不能是图灵完备。 如果我无法使用您的语言编写任何其他语言的编译器或解释器,则您的语言不是图灵完整的。

Yes, this is true.


Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete and should not be used by anyone.

当前,您无法在Python 3虚拟机中运行Python 2。 既然不能,那意味着Python 3不是Turing Complete,任何人都不应使用。

And this is completely asinine. Worse, it’s flat-out dishonest, and relies on another rhetorical trick. You only “cannot” run Python 2 inside the Python 3 VM because no one has written a Python 2 interpreter in Python 3. The “cannot” is not a mathematical impossibility; it’s a simple matter of the code not having been written. Or perhaps it has, but no one cares anyway, because it would be comically and unusably slow.

这完全是愚蠢的。 更糟糕的是,这完全是不诚实的,并且依赖于另一种修辞手法。 您只能“无法”在Python 3 VM中运行Python 2,因为没有人用Python 3编写过Python 2解释器。 这是没有编写代码的简单问题。 也许它有,但无论如何都没有人在乎,因为它会很可笑而且非常缓慢。

I assume this was meant to be sarcastic on some level, since it’s followed by a big blue box that seems unsure about whether to double down or reverse course. But I can’t tell why it was even brought up, because it has absolutely nothing to do with Zed’s true complaint, which is that Python 2 and Python 3 do not coexist within a single environment. Implementing language X using language Y does not mean that X and Y can now be used together seamlessly.

我认为这在某种程度上是讽刺的,因为它后面是一个很大的蓝框,似乎不确定是加倍还是反转。 但是我无法说出它为什么被提出来,因为它与Zed的真正抱怨完全无关,后者是Python 2和Python 3不在一个环境中共存。 使用语言Y实现语言X并不意味着X和Y现在可以无缝地一起使用。

The canonical Python release is written in C (just like with Ruby or Lua), but you can’t just dump a bunch of C code into a Python (or Ruby or Lua) file and expect it to work. You can talk to C from Python and vice versa, but defining how they communicate is a bit of a pain in the ass and requires some level of setup.

规范的Python版本是用C编写的(就像使用Ruby或Lua一样),但是您不能只是将一堆C代码转储到Python(或Ruby或Lua)文件中并期望它能工作。 您可以从Python与C交谈,反之亦然,但是定义它们的通信方式有点麻烦,并且需要某种程度的设置。

I’ll get into this some more shortly.


Python 3 comes with a tool called 2to3 which is supposed to take Python 2 code and translate it to Python 3 code.

Python 3附带了一个名为2to3的工具,该工具应该采用Python 2代码并将其转换为Python 3代码。

I should point out right off the bat that this is not actually what you want to use most of the time, because you probably want to translate your Python 2 code to Python 2/3 code. 2to3 produces code that most likely will not work on Python 2. Other tools exist to help you port more conservatively.

我应该马上指出,这实际上并不是您大部分时间想要使用的,因为您可能想将Python 2代码转换为Python 2/3代码。 2to3生成的代码很可能无法在Python 2上运行。 其他工具可以帮助您更加保守地移植。

Translating one programming language into another is a solidly researched topic with solid math behind it. There are translators that convert any number of languages into JavaScript, C, C++, Java, and many times you have no idea the translation is being done. In addition to this, one of the first steps when implementing a new language is to convert the new language into an existing language (like C) so you don’t have to write a full compiler. Translation is a fully solved problem.

将一种编程语言转换为另一种语言是一个经过深入研究的主题,其背后是扎实的数学运算。 有一些翻译器可以将多种语言转换为JavaScript,C,C ++,Java,而且很多时候您都不知道翻译已经完成。 除此之外,实现新语言时的第一步就是将新语言转换为现有语言(例如C),这样就不必编写完整的编译器。 翻译是一个完全解决的问题。

This is completely fucking ludicrous. Translating one programming language to another is a common task, though “fully solved” sounds mighty questionable. But do you know what the results look like?

这完全是可笑的。 将一种编程语言转换为另一种编程语言是一项常见的任务,尽管“完全解决”听起来很成问题。 但是您知道结果如何吗?

I found a project called “Transcrypt”, which puts Python in the browser by “translating” it to JavaScript. I’ve never used or heard of this before; I just googled for something to convert Python to JavaScript. Here’s their first sample, a demo using jQuery:

我找到了一个名为“ Transcrypt”的项目,该项目通过将Python“翻译”为JavaScript来将其放入浏览器。 我以前从未使用过或听说过; 我只是在谷歌上搜索将Python转换为JavaScript的东西。 这是他们的第一个示例,一个使用jQuery演示


def def start start ():
    def def changeColors changeColors ():
        for for div div in in S__divsS__divs :
            S S (( divdiv ) ) .. css css ({
                'color''color' : : 'rgb({},{},{})''rgb({},{},{})' .. format format (( * * [[ int int (( 256 256 * * MathMath .. random random ()) ()) for for i i in in range range (( 33 )]),


    S__divs S__divs = = S S (( 'div''div' )
    changeColors changeColors ()
    windowwindow .. setInterval setInterval (( changeColorschangeColors , , 500500 )

And here’s the JavaScript code it compiles to:



Well, not quite. That’s actually just a small piece at the end of the full 1861-line file.

好吧,不完全是。 实际上,这只是整个1861行文件末尾的一小部分。

You may notice that the emitted JavaScript effectively has to emulate the Python for loop, because JavaScript doesn’t have anything that works exactly the same way. And this is a basic, common language feature translated between two languages in the same general family! Imagine how your code would look if you relied on gritty details of how classes are implemented.

您可能会注意到,发出JavaScript必须有效地模拟Python for循环,因为JavaScript的工作原理完全不同。 这是在同一个普通家族中的两种语言之间翻译的一种基本的通用语言功能! 想象一下,如果您依赖于如何实现类的详细细节,代码将如何显示。

Is this what you want 2to3 to do to your code?


Even if something has been proven to be mathematically possible, that doesn’t mean it’s easy, and it doesn’t mean the results will be pretty (or fast).


The 2to3 translator fails on about 15% of the code it attempts, and does a poor job of translating the code it can handle. The motivations for this are unclear, but keep in mind that a group of people who claim to be programming language experts can’t write a reliable translator from one version of their own language to another. This is also a cause of their porting problems, which adds up to more evidence Python 3’s future is uncertain.

2to3转换程序在尝试执行的大约15%的代码上失败,并且在转换其可以处理的代码方面做得很差。 这样做的动机尚不清楚,但请记住,一群自称是编程语言专家的人无法编写从自己的一种语言到另一种语言的可靠翻译器。 这也是导致它们移植问题的原因,这增加了更多证据,证明Python 3的前途未卜。

Writing a translator from one language to another is a fully proven and fundamental piece of computer science. Yet, the 2to3 translator cannot translate code 100%. In my own tests it is only about 85% effective, leaving a large amount of code to translate manually. Given that translation is a solved problem this seems to be a decision bordering on malice rather than incredible incompetence.

从一种语言到另一种语言编写翻译器是计算机科学的一项行之有效的基础知识。 但是,2to3转换器不能100%翻译代码。 在我自己的测试中,它只有大约85%的有效率,剩下大量代码可以手动翻译。 鉴于翻译是一个已解决的问题,这似乎是一个恶意的决定,而不是难以置信的无能。

The programmer-oriented section doubles down on this idea with a title of “Purposefully Crippled 2to3 Translator” — again, accusing the Python project of sabotaging everyone. That doesn’t even make sense; if their goal is to make everyone use Python 3 at any cost, why would they deliberately break their tool that reduces the amount of Python 2 code and increases the amount of Python 3 code?

面向程序员的部分以“故意削弱2to3转换器”的标题加倍了这个想法,再次指责Python项目破坏了所有人。 那甚至没有道理; 如果他们的目标是让所有人不惜一切代价使用Python 3,为什么他们会故意破坏其工具以减少Python 2代码量并增加Python 3代码量?

2to3 sucks because its job is hard. Python is dynamically typed. If it sees d.iteritems(), it might want to change that to d.items(), as it’s called in Python 3 — but it can’t always be sure that d is actually a dict. If d is some user-defined type, renaming the method is wrong.

2to3很烂,因为它的工作很辛苦。 Python是动态类型的。 如果看到d.iteritems() ,它可能希望将其更改为d.items() ,就像在Python 3中所称的那样-但不能总是确保d实际上是一个dict 。 如果d是某些用户定义的类型,则重命名该方法是错误的。

But hey, Turing-completeness, right? It must be mathematically possible. And it is! As long as you’re willing to see this:

但是,嘿,图灵完备,对吗? 在数学上必须是可能的。 是的! 只要您愿意看到以下内容:

for for keykey , , value value in in dd .. iteritemsiteritems ():

Get translated to this:


Would Zed be happier with that, I wonder?


Yet, for some reason, the Python 3 virtual machine can’t run Python 2? Despite the solidly established mathematics disproving this, the countless examples of running one crazy language inside a Russian doll cascade of other crazy languages, and huge number of languages that can coexist in nearly every other virtual machine? That makes no sense.

但是,由于某种原因,Python 3虚拟机无法运行Python 2? 尽管已有可靠的数学方法证明了这一点,但在无数其他疯狂语言的俄罗斯玩偶级联中运行一种疯狂语言的无数示例,以及几乎可以在所有其他虚拟机中共存的大量语言? 这是没有意义的。

This, finally, is the real complaint. It’s not a bad one, and it comes up sometimes, but… it’s not this easy.

最后,这是真正的抱怨。 这不是一个坏问题,有时会出现,但是……这并不容易。

The Python 3 VM is fairly similar to the Python 2 VM. The problem isn’t the VM, but the core language constructs and standard library.

Python 3 VM非常类似于Python 2 VM 。 问题不是VM ,而是核心语言结构和标准库。

Consider: what happens when a Python 2 old-style class instance gets passed into Python 3, which has no such concept? It seems like a value would have to always have the semantics of the language version it came from — that’s how languages usually coexist on the same VM, anyway.

考虑:当没有这种概念的Python 2旧式类实例传递给Python 3时会发生什么? 似乎值必须始终具有其来源的语言版本的语义-无论如何,这通常是语言通常在同一VM上共存的方式。

Now, I’m using Python 3, and I load some library written for Python 2. I call a Python 2 function that deals with bytestrings, and I pass it a Python 3 bytestring. Oh no! It breaks because Python 3 bytestrings iterate as integers, whereas the Python 2 library expects them to iterate as characters.

现在,我正在使用Python 3,并加载了一些为Python 2编写的库。我调用了一个处理字节串的Python 2函数,并向其传递了Python 3字节串。 不好了! 它之所以中断,是因为Python 3字节串以整数形式进行迭代,而Python 2库希望它们以字符形式进行迭代。

Okay, well, no big deal, you say. Maybe Python 2 libraries just need to be updated to work either way, before they can be used with Python 3.

好吧,没什么大不了的,你说。 也许只需要对Python 2库进行更新即可使用其中任何一种方法,然后它们才能与Python 3一起使用。

But that’s exactly the situation we’re in right now. Syntax changes are trivially fixed by 2to3 and similar tools. It’s libraries that cause the subtler issues.

但这正是我们现在所处的状况 。 语法更改由2to3和类似工具轻松修复。 是导致微妙问题的库。

The same applies the other way, too. I write Python 3 code, and it gets an int from some Python 2 library. I try to use the .to_bytes method on it, but that doesn’t exist on Python 2 integers. So my Python 3 code, written and intended purely for Python 3, now has to deal with Python 2 integers as well.

其他方式也一样。 我编写了Python 3代码,它从一些Python 2库中获取了一个int 。 我尝试在其上使用.to_bytes方法,但是在Python 2整数上不存在。 因此,我的Python 3代码(纯粹为Python 3编写和使用)现在也必须处理Python 2整数。

Perhaps “primitive” types should convert automatically, on the boundary? Okay, sure. What about the Python 2 buffer type, which is C-backed and replaced by memoryview in Python 3?

也许“原始”类型应该在边界上自动转换? 好的,当然。 怎么样?Python 2 buffer类型是C支持的,在Python 3中被memoryview取代了吗?

Or how about this very fundamental problem: names of methods and other attributes are str in both versions, but that means they’re bytestrings in Python 2 and text in Python 3. If you’re in Python 3 land, and you call on a Python 2 object, what happens? Python 3 wants a method with the text name foo, but Python 2 wants a method with the bytes name foo. Text and bytes are not implicitly convertible in Python 3. So does it error? Somehow work anyway? What about the other way around?

或者说这个非常根本的问题:方法和其他属性的名称在两个版本中都是str ,但这意味着它们在Python 2中是字节串,在Python 3中是文本。如果您在Python 3中,则调用在Python 2对象上的 ,会发生什么? Python 3需要文本名称为foo的方法,但是Python 2需要字节名称为foo 。 文本和字节在Python 3中不能隐式转换。这会出错吗? 无论如何工作? 那反过来呢?

What about the standard library, which has had a number of improvements in Python 3 that don’t or can’t exist in Python 2? Should Python ship two entire separate copies of its standard library? What about modules like logging, which rely on global state? Does Python 2 and Python 3 code need to set up logging separately within the same process?

标准库又如何呢?标准库在Python 3中进行了许多改进,而这些改进在Python 2中不存在或不存在? Python是否应该提供其标准库的两个完整的单独副本? 依赖于全局状态的logging模块呢? Python 2和Python 3代码是否需要在同一过程中分别设置日志记录?

There are no good solutions here. The language would double in size and complexity, and you’d still end up with a mess at least as bad as the one we have now when values leak from one version into the other.

这里没有好的解决方案。 这种语言的大小和复杂性将增加一倍,当值从一个版本泄漏到另一个版本时,您仍然会陷入至少与现在一样糟糕的混乱。

We either have two situations here:


  1. Python 3 has been purposefully crippled to prevent Python 2’s execution alongside Python 3 for someone’s professional or ideological gain.
  2. Python 3 cannot run Python 2 due to simple incompetence on the part of the Python project.
  1. Python 3被故意残废,以防止Python 2与Python 3一起执行,这是为了某人的专业或思想上的收获。
  2. 由于Python项目方面的简单权限,Python 3无法运行Python 2。

I can think of a third.


The strings in Python 3 are very difficult to use for beginners. In an attempt to make their strings more “international” they turned them into difficult to use types with poor error messages.

Python 3中的字符串对于初学者来说很难使用。 为了使它们的字符串更“国际化”,他们将它们变成难于使用且错误信息较少的类型。

Why is “international” in scare quotes?


Every time you attempt to deal with characters in your programs you’ll have to understand the difference between byte sequences and Unicode strings.


Given that I’m reading part of a book teaching Python, this would be a perfect opportunity to drive this point home by saying “Look! Running exercise N in Python 3 doesn’t work.” Exercise 1, at least, works fine for me with a little extra sprinkle of parentheses:

鉴于我正在阅读一本有关Python的书,因此这是一个绝佳的机会,说“看! 在Python 3中运行练习N无效。” 练习1至少对我有用,但要加上一点括号:


printprint (( "Hello World!""Hello World!" )
printprint (( "Hello Again""Hello Again" )
printprint (( "I like typing this.""I like typing this." )
printprint (( "This is fun.""This is fun." )
printprint (( 'Yay! Printing.''Yay! Printing.' )
printprint (( "I'd much rather you 'not'.""I'd much rather you 'not'." )
printprint (( 'I "said" do not touch this.''I "said" do not touch this.' )

Contrast with the actual content of that exercise — at the bottom is a big red warning box telling people from “another country” (relative to where?) that if they get errors about ASCII encodings, they should put an unexplained magical incantation at the top of their scripts to fix “Unicode UTF-8”, whatever that is. I wonder if Zed has read his own book.

与该练习的实际内容相反,在底部是一个红色的大警告框,告诉“另一个国家”的人们(相对于哪里?),如果他们在ASCII编码方面遇到错误,则应在顶部放一个无法解释的魔咒。他们的脚本来修复“ Unicode UTF -8”,无论是什么。 我想知道Zed是否读过自己的书。

Don’t know what that is? Exactly.

不知道那是什么吗? 究竟。

If only there were a book that could explain it to beginners in more depth than “you have to fix this if you’re foreign”.


The Python project took a language that is very forgiving to beginners and mostly “just works” and implemented strings that require you to constantly know what type of string they are. Worst of all, when you get an error with strings (which is very often) you get an error message that doesn’t tell you what variable names you need to fix.

Python项目采用了一种对初学者来说非常宽容的语言,并且大多数情况下“是可行的”,并且实现了字符串,要求您不断了解它们是什么类型的字符串。 最糟糕的是,当您遇到字符串错误(这很常见)时,会收到一条错误消息,其中没有告诉您需要修复哪些变量名。

The complaint is that this happens in Python 3, whereas it’s accepted in Python 2:

抱怨是这在Python 3中发生,而在Python 2中被接受:

>>> b"hello" + "hello"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't concat bytes to str

The programmer section is called “Statically Typed Strings”. But this is not static typing. That’s strong typing, a property that sets Python’s type system apart from languages like JavaScript. It’s usually considered a good thing, because the alternative is to silently produce nonsense in some cases, and then that nonsense propagates through your program and is hard to track down when it finally causes problems.

程序员部分称为“静态类型的字符串”。 但这不是静态类型。 这是强类型化 ,这是将Python的类型系统与JavaScript等语言区分开的属性。 通常认为这是一件好事,因为替代方法是在某些情况下以静默方式产生废话,然后废话会在您的程序中传播,并且在最终导致问题时很难对其进行跟踪。

If they’re going to require beginners to struggle with the difference between bytes and Unicode the least they could do is tell people what variables are bytes and what variables are strings.


That would be nice, but it’s not like this is a new problem. Try this in Python 2.

那样很好,但是这并不是一个新问题。 在Python 2中尝试一下。

>>> 3 + "hello"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

How would Python even report this error when I used literals instead of variables? How could custom types hook into such a thing? Error messages are hard.

当我使用文字而不是变量时,Python怎么会报告此错误? 自定义类型如何与这种事情挂钩? 错误消息很难。

By the way, did you know that several error messages are much improved in Python 3? Python 2 is somewhat notorious for the confusing errors it produces when an argument is missing from a method call, but Python 3 is specific about the problem, which is much friendlier to beginners.

顺便说一句,您是否知道Python 3 大大改善了一些错误消息 ? 当方法调用中缺少参数时,Python 2会因产生混乱的错误而臭名昭著,但是Python 3专门针对该问题,这对初学者而言更为友好。

However, when you point out that this is hard to use they try to claim it’s good for you. It is not. It’s simple blustering covering for a poor implementation.

但是,当您指出这很难使用时,他们会尝试声称它对您有好处。 它不是。 它只是简单的缓冲,可用于较差的实现。

I don’t know what about this is hard. Why do you have a text string and a bytestring in the first place? Why is it okay to refuse adding a number to a string, but not to refuse adding bytes to a string?

我不知道这很难。 为什么首先要有一个文本字符串和一个字节字符串? 为什么可以拒绝在字符串中添加数字,而不拒绝在字符串中添加字节,为什么呢?

Imagine if one of the Python core developers were just getting into Python 2 and messing around.

试想一下,如果一位Python核心开发人员刚刚进入Python 2并搞砸了。

Hi, my name is Łukasz Langa.
.agnaL zsaku�� si eman ym ,iH

Good luck figuring out how to fix that.


This isn’t blustering. Bytes are not text; they are binary data that could encode anything. They happen to look like text sometimes, and you can get away with thinking they’re text if you’re not from “another country”, but that mindset will lead you to write code that is wrong. The resulting bugs will be insidious and confusing, and you’ll have a hard time even reasoning about them because it’ll seem like “Unicode text” is somehow a different beast altogether from “ASCII text”.

这不是鼓舞人心的。 字节不是文本; 它们是可以编码任何东西的二进制数据。 它们有时有时看起来像文本,并且如果您不是来自“另一个国家”,那么您就可以认为它们是文本,但是这种思维方式会导致您编写错误的代码。 由此产生的错误将变得阴险而令人困惑,您甚至很难对它们进行推理,因为看起来“ Unicode文本”与“ ASCII文本”完全不同。

Exercise 11 mentions at the end that you can use int() to convert a number to an integer. It’s no more complicated to say that you convert bytes to a string using .decode(). It shouldn’t even come up unless you’re explicitly working with binary data, and I don’t see any reading from sockets in LPTHW.

练习11最后提到可以使用int()将数字转换为整数。 使用.decode()将字节转换为字符串并不复杂。 除非您明确地使用二进制数据,否则它甚至都不会出现,而且我看不到LPTHW中的套接字读取任何内容。

It’s also not statically compiled as strongly as it could be, so you can’t find these kinds of type errors until you run the code.


This comes a scant few paragraphs after “Dynamic typing is what makes Python easy to use and one of the reasons I advocate it for beginners.”


You can’t find any kinds of type errors until you run the code. Welcome to dynamic typing.

在运行代码之前,您将找不到任何类型的错误。 欢迎使用动态输入。

Strings are also most frequently received from an external source, such as a network socket, file, or similar input. This means that Python 3’s statically typed strings and lack of static type safety will cause Python 3 applications to crash more often and have more security problems when compared with Python 2.

字符串也是从外部资源(例如网络套接字,文件或类似输入)中最常接收到的。 这意味着与Python 2相比,Python 3的静态类型的字符串和缺乏静态类型的安全性将导致Python 3应用程序崩溃的频率更高,并且存在更多的安全问题。

On the contrary — Python 3 applications should crash less often. The problem with silently converting between bytestrings and text in Python 2 is that it might fail, depending on the contents. "cafe" + u"hello" works fine, but "café" + u"hello" raises a UnicodeDecodeError. Python 2 makes it very easy to write code that appears to work when tested with ASCII data, but later breaks with anything else, even though the values are still the same types. In Python 3, you get an error the first time you try to run such code, regardless of what’s in the actual values. That’s the biggest reason for the change: it improves things from being intermittent value errors to consistent type errors.

相反,Python 3应用程序应该减少崩溃的频率。 在Python 2中以静默方式在字节串和文本之间进行转换的问题在于,它可能会失败,具体取决于内容。 "cafe" + u"hello"工作正常,但是"café" + u"hello"引发UnicodeDecodeError 。 Python 2使得编写使用ASCII数据测试时似乎可以正常工作的代码变得非常容易,但是即使值仍然是相同的类型,以后也会中断其他操作。 在Python 3中,无论实际值是多少,在您首次尝试运行此类代码时都会遇到错误。 这是做出此更改的最大原因:它将间歇性的值错误改善为一致的类型错误。

More security problems? This is never substantiated, and seems to have been entirely fabricated.

还有更多安全性问题吗? 这从来没有得到证实,而且似乎是完全捏造的。

In addition to that you will have 3 different formatting options in Python 3.6. That means you’ll have to learn to read and use multiple ways to format strings that are all very different. Not even I, an experienced professional programmer, can easily figure out these new formatting systems or keep up with their changing features.

除此之外,Python 3.6还提供3种不同的格式选项。 这意味着您将必须学习阅读和使用多种方式来格式化完全不同的字符串。 甚至我,一个经验丰富的专业程序员,都无法轻易找出这些新的格式化系统或跟上它们不断变化的功能。

I don’t know what on earth “keep up with their changing features” is supposed to mean, and Zed doesn’t bother to go into details.


Python 3 has three ways to format strings: % interpolation, str.format(), and the new f"" strings in Python 3.6. The f"" strings use the same syntax as str.format(); the difference is that where str.format() uses numbers or names of keyword arguments, f"" strings just use expressions. Compare:

Python 3提供了三种格式化字符串的方式: %插值, str.format()和Python 3.6中的新f""字符串。 f""字符串使用与str.format()相同的语法; 区别在于str.format()使用数字或关键字参数名称,而f""字符串仅使用表达式。 比较:

number number = = 133
printprint (( "{n:02x}""{n:02x}" .. formatformat (( nn == numbernumber ))
printprint (( ff "{number:02x}""{number:02x}" )

This isn’t “very different”. A frequently-used method is being promoted to syntax.

这不是“非常不同”。 常用的方法正在升级为语法。

I really like this new style, and I have no idea why this wasn’t the formatting for Python 3 instead of that stupid .format function. String interpolation is natural for most people and easy to explain.

我真的很喜欢这种新样式,我不知道为什么这不是Python 3的格式,而不是那个愚蠢的.format函数。 字符串插值对大多数人来说很自然,而且很容易解释。

The problem is that beginner will now how to know all three of these formatting styles, and that’s too many.


I could swear Zed, an experienced professional programmer, just said he couldn’t easily figure out these new formatting systems. Note also that str.format() has existed in Python 2 since Python 2.6 was released in 2008, so I don’t know why Zed said “new formatting systems“, plural.

我可以向经验丰富的专业程序员Zed发誓,他只是说他不容易弄清楚这些新的格式化系统。 还请注意,自2008年发布Python 2.6以来, str.format()就已经存在于Python 2中,因此我不知道Zed为什么说“复数格式系统”。

This is a truly bizarre complaint overall, because the mechanism Zed likes best is the newest one. If Python core had agreed that three mechanisms was too many, we wouldn’t be getting f"" at all.

总的来说,这是一个真正的怪异投诉,因为Zed最喜欢的机制是最新的一种。 如果Python核心同意三种机制太多,那么我们根本就不会得到f""

Finally, I’m told there is a new proposal for a string type that is both bytes and Unicode at the same time? That’d be fantastic if this new type brings back the dynamic typing that makes Python easy, but I’m betting it will end up being yet another static type to learn. For that reason I also think beginners should avoid Python 3 until this new “chimera string” is implemented and works reliably in a dynamic way. Until then, you will just be dealing with difficult strings that are statically typed in a dynamically typed language.

最后,我被告知有一个针对字符串类型的新建议,该字符串类型同时为字节和Unicode? 如果这种新类型带回了使Python变得容易的动态类型,那将是很棒的,但是我敢打赌,它将最终成为另一种需要学习的静态类型。 因此,我还认为初学者应该避免使用Python 3,直到实现了这种新的“嵌合体字符串”并以动态方式可靠地工作。 在此之前,您将只处理用动态类型语言静态键入的困难字符串。

I have absolutely no idea what this is referring to, and I can’t find anyone who does. I don’t see any recent PEPs mentioning such a thing, nor anything in the last several months on the python-dev mailing list. I don’t see it in the Python 3.6 release notes.

我完全不知道这是指什么,也找不到任何人这样做。 在最近几个月的python-dev邮件列表中 ,我没有看到任何PEP提及此事。 我没有在Python 3.6发行说明中看到它。

The closest thing I can think of is the backwards-compatibility shenanigans for PEP 528 and PEP 529 — they switch to the Windows wide-string APIs for console and filesystem encoding, but pretend under the hood that the APIs take UTF-8-encoded bytes to avoid breaking libraries like Twisted. That’s a microscopic detail that should never matter to anyone but authors of Twisted, and is nothing like a new hybrid string type, but otherwise I’m at a loss.

我能想到的最接近的是PEP 528PEP 529的向后兼容含义-它们切换到Windows宽字符串API进行控制台和文件系统编码,但是假装API接受UTF -8编码的字节避免破坏Twisted之类的库。 这是一个微观的细节,除了Twisted的作者以外,对任何人都不重要,并且与新的混合字符串类型完全不同,但否则我茫然。

This paragraph really is a perfect summary of the whole article. It speaks vaguely yet authoritatively about something that doesn’t seem to exist, it doesn’t bother actually investigating the thing the entire section talks about, it conjectures that this mysterious feature will be hard just because it’s in Python 3, and it misuses terminology to complain about a fundamental property of Python that’s always existed.

本段确实是整篇文章的完美总结。 它模糊地,权威地谈论着似乎不存在的某些事物,它并没有真正去研究整个部分所谈论的事物,它猜想这个神秘的功能将很难实现,因为它在Python 3中,并且滥用了术语。抱怨Python一直存在的基本属性。

Many of the core libraries included with Python 3 have been rewritten to use Python 3, but have not been updated to use its features. How could they given Python 3’s constant changing status and new features?

Python 3附带的许多核心库已被重写为使用Python 3,但尚未更新为使用其功能。 他们如何赋予Python 3不断变化的状态和新功能?

What “constant changing status”? The language makes new releases; is that bad? The only mention of “changing” so far was with string formatting, which makes no sense to me, because the only major change has been the addition of syntax that Zed prefers.

什么是“不断变化的状态”? 该语言发布了新版本; 那不好吗? 到目前为止,唯一提及“更改”的是字符串格式,这对我来说是没有意义的,因为唯一的主要变化就是添加了Zed首选的语法。

There are several libraries that, despite knowing the encoding of data, fail to return proper strings. The worst offender seems to be any libraries dealing with the HTTP protocol, which does indicate the encoding of the underlying byte stream in many cases.

尽管知道数据的编码,但是有几个库无法返回正确的字符串。 危害最大的似乎是处理HTTP协议的任何库,在许多情况下,该库的确表明了底层字节流的编码。

In many cases, yes. Not in all. Some web servers don’t send back an encoding. Some files don’t have an encoding, because they’re images or other binary data. HTML allows the encoding to be given inside the document, instead. urllib has always returned bytes, so it’s not all that unreasonable to keep doing that, rather than… well, I’m not quite sure what this is proposing. Return strings sometimes?

在很多情况下,是的。 并非全部。 某些Web服务器不发送回编码。 有些文件没有编码,因为它们是图像或其他二进制数据。 HTML允许在文档内部提供编码。 urllib总是返回字节,因此继续执行操作并非不是所有的不合理,而是……嗯,我不太确定这是什么建议。 有时返回字符串?

The documentation for urllib.request and http.client both advise using the higher-level Requests library instead, in a prominent yellow box right at the top. Requests has distinct mechanisms for retrieving bytes versus text and is vastly easier to use overall, though I don’t think even it understands reading encodings from HTML. Alas, computers.

urllib.requesthttp.client文档都建议使用更高级的Requests库,而不是在顶部的醒目的黄色框中。 请求具有截取字节和文本的独特机制,并且整体上使用起来非常容易,尽管我认为即使它也不了解从HTML读取编码。 computers,计算机。

Good luck to any beginner figuring out how to install Requests on Python 2 — but thankfully, Python 3 now comes bundled with pip, which makes installing libraries much easier. Contrast with the beginning of exercise 46, which apologizes for how difficult this is to explain, lists four things to install, warns that it will be frustrating, and advises watching a video to help figure it out.

祝所有初学者弄清楚如何在Python 2上安装请求的运气–但幸运的是,Python 3现在与pip捆绑在一起,这使安装库变得更加容易。 与练习46的开始形成鲜明对比, 练习46对此道歉很困难,并为此道歉,列出了要安装的四件事,警告它会令人沮丧,并建议观看视频以帮助解决问题。

What’s even more idiotic about this is Python has a really good Chardet library for detecting the encoding of byte streams. If Python 3 is supposed to be “batteries included” then fast Chardet should be baked into the core of Python 3’s strings making it cake to translate strings to bytes even if you don’t know the underlying encoding. … Call the function whatever you want, but it’s not magic to guess at the encoding of a byte stream, it’s science. The only reason this isn’t done for you is that the Python project decided that you should be punished for not knowing about bytes vs. Unicode, and their arrogance means you have difficult to use strings.

更愚蠢的是,Python有一个非常好的Chardet库,用于检测字节流的编码。 如果应该说Python 3是“包含电池”,那么应该将快速的Chardet烘焙到Python 3字符串的核心中,即使您不知道底层编码,也可以将字符串转换为字节。 …随意调用该函数,但是猜测字节流的编码并不是魔术,这是科学。 不为您完成此操作的唯一原因是Python项目决定您应该因不了解字节和Unicode而受到惩罚,它们的傲慢意味着您难以使用字符串。

Guessing at the encoding of a byte stream isn’t so much science as, well, guessing. Guessing means that sometimes you’re wrong. Sometimes that’s what you want, and I’m honestly ambivalent about having chardet in the standard library, but it’s hardly arrogant to not want to include a highly-fallible heuristic in your programming language.

猜测字节流的编码不是科学,而是猜测。 猜测意味着有时候你错了 。 有时候,这就是您想要的,而且我对在标准库中使用chardet确实很矛盾,但是不想在您的编程语言中包含一个非常容易犯错的启发式方法并不难为傲。

I have resisted writing about these problems with Python 3 for 5 versions because I hoped it would become usable for beginners. Each year I would attempt to convert some of my code and write a couple small tests with Python 3 and simply fail. If I couldn’t use Python 3 reliably then there’s no way a total beginner could manage it. So each year I’d attempt it, and fail, and wait until they fix it. I really liked Python and hoped the Python project would drop their stupid stances on usability.

我一直拒绝使用5版本的Python 3编写有关这些问题的文章,因为我希望它对初学者有用。 每年,我都会尝试转换一些代码,并使用Python 3编写一些小型测试,但都失败了。 如果我不能可靠地使用Python 3,那么完全没有初学者可以管理它。 因此,每年我都会尝试它,然后失败,然后等待他们修复它。 我真的很喜欢Python,并希望Python项目能够放弃他们对可用性的愚蠢态度。

Let us recap the usability problems seen thusfar.


  • You can’t add b"hello" to "hello".
  • TypeErrors are phrased exactly the same as they were in Python 2.
  • The type system is exactly as dynamic as it was in Python 2.
  • There is a new formatting mechanism, using the same syntax as one in Python 2, that Zed prefers over the ones in Python 2.
  • urllib.request doesn’t decode for you, just like in Python 2.
  • 档牡敤㽴 isn’t built in. Oh, sorry, I meant chardet.
  • 您不能将b"hello"添加到"hello"
  • TypeError的用语与Python 2中的完全相同。
  • 类型系统与Python 2中的动态系统完全一样。
  • 有一种新的格式化机制,使用与Python 2中的语法相同的语法,Zed更喜欢使用Python 2中的语法。
  • urllib.request不会为您解码,就像在Python 2中一样。
  • 档牡敤㽴 。抱歉,我的意思是chardet

Currently, the state of strings is viewed as a Good Thing in the Python community. The fact that you can’t run Python 2 inside Python 3 is seen as a weird kind of tough love. The brainwashing goes so far as to outright deny the mathematics behind language translation and compilation in an attempt to motivate the Python community to brute force convert all Python 2 code.

当前,字符串状态在Python社区中被视为一件好事。 您无法在Python 3中运行Python 2的事实被视为一种奇怪的强硬爱情。 洗脑行动甚至彻底否认了语言翻译和编译背后的数学原理,目的是激发Python社区蛮力地转换所有Python 2代码。

Which is probably why the Python project focuses on convincing unsuspecting beginners to use Python 3. They don’t have a switching cost, so if you get them to fumble their way through the Python 3 usability problems then you have new converts who don’t know any better. To me this is morally wrong and is simply preying on people to prop up a project that needs a full reset to survive. It means beginners will fail at learning to code not because of their own abilities, but because of Python 3’s difficulty.

这可能就是为什么Python项目专注于说服毫无戒心的初学者使用Python 3的原因。他们没有转换成本,因此,如果您让他们在Python 3可用性问题中摸索,那么您会发现没有这样做的新转换者知道什么更好。 对我来说,这在道德上是错误的,只是在诱使人们支持一个需要完全重置才能生存的项目。 这意味着初学者学习编码的失败不是因为他们自己的能力,而是因为Python 3的困难。

Now that we’re towards the end, it’s a good time to say this: Zed Shaw, your behavior here is fucking reprehensible.

既然我们快要结束了,现在是时候这样说: Zed Shaw,您在这里的举止是可恶的。

Half of what’s written here is irrelevant nonsense backed by a vague appeal to “mathematics”. Instead of having even the shred of humility required to step back and wonder if there are complicating factors beyond whether something is theoretically possible, you have invented a variety of conflicting and malicious motivations to ascribe to the Python project.

这里写的一半是无关紧要的废话,以模糊地呼吁“数学”为后盾。 您甚至没有退后一步就想知道是否有其他复杂因素(除了理论上是否可行),还发明了各种冲突和恶意的动机来归因于Python项目。

It’s fine to criticize Python 3. The string changes force you to think about what you’re doing a little more in some cases, and occasionally that’s a pain in the ass. I absolutely get it.

批评Python 3很好。在某些情况下,字符串的变化会迫使您考虑自己在做什么,有时候这很麻烦。 我绝对明白。

But you’ve gone out of your way to invent a conspiracy out of whole cloth and promote it on your popular platform aimed at beginners, who won’t know how obviously full of it you are. And why? Because you can’t add b"hello" to "hello"? Are you kidding me? No one can even offer to help you, because instead of examples of real problems you’ve had, you gave two trivial toys and then yelled a lot about how the whole Python project is releasing mind-altering chemicals into the air.

但是,您已经全力以赴地发明了一个阴谋,并在面向初学者的流行平台上推广了这种阴谋,这些人不知道您有多明显。 又为什么呢 因为不能将b"hello"添加到"hello" ? 你在跟我开玩笑吗? 没人能提供帮助,因为您没有举过实际的例子,而是给了两个琐碎的玩具,然后大喊大叫,整个Python项目如何向人们释放改变思想的化学物质。

The Python 3 migration has been hard enough. It’s taken a lot of work from a lot of people who’ve given enough of a crap to help Python evolve — to make it better to the best of their judgment and abilities. Now we’re finally, finally at the point where virtually all libraries support Python 3, a few new ones only support Python 3, and Python 3 adoption is starting to take hold among application developers.

Python 3迁移已经足够困难。 许多人付出了很多工作,他们做了很多废话,以帮助Python进行发展-使其发挥最大的判断力和能力。 现在,我们终于到了几乎所有库都支持Python 3的地步,一些新库仅支持Python 3,并且在应用程序开发人员中开始采用Python 3。

And you show up to piss all over it, to propagate this myth that Python 3 is hamstrung to the point of unusability, because if the Great And Wise Zed Shaw can’t figure it out in ten seconds then it must just be impossible.

然后,您会在整个过程中出现小便,以传播Python 3陷入无法使用的神话,因为如果Great And Wise Zed Shaw无法在十秒钟之内解决问题,那肯定是不可能的。

Fuck you.


Sadly, I doubt this will happen, and instead they’ll just rant about how I don’t know what I’m talking about and I should shut up.



评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页