Maison > Article > développement back-end > 为什么像 Java、C、C++ 这样的静态语言会比 Python、Ruby 这样的动态语言流行得多?
个人觉得像 Ruby 这样的动态语言简洁得多。
<code class="language-python"><span class="n">a</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">];</span>
<span class="k">print</span><span class="p">(</span><span class="n">a</span><span class="p">[</span><span class="s">'1'</span><span class="p">]);</span>
<span class="n">b</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">'a'</span><span class="p">:</span><span class="mi">2</span><span class="p">};</span>
<span class="k">print</span><span class="p">(</span><span class="n">a</span><span class="p">[</span><span class="s">'0'</span><span class="p">]);</span>
</code>
C/C++ 有强烈的学术背景,Java / C# 有强烈的商业背景,这些背景确保了有足够多的人和公司对这些语言有信心,从而促进了这些语言的大规模应用,之后就靠惯性了。