6hz7vif 发表于 2024-8-17 08:43:43

有人说,Python比C语言难?该怎么反驳


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">记得我<span style="color: black;">第1</span>次学编程语言,是本科时的C语言选修课程,当时的感觉是编程真的好<span style="color: black;">繁杂</span>,什么指针、断言、动态分配等<span style="color: black;">各样</span>概念,完全搞不懂啊。后来哼哧哼哧考了个七十多分,算是过关了。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-axegupay5k/45890fe0f7ed436187d47608b1871200~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=clGd027cgQubuem0FELIZyt1z%2Fo%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">后来<span style="color: black;">晓得</span>C是偏硬件的编程语言,<span style="color: black;">重点</span>的用途是系统<span style="color: black;">研发</span>、嵌入式<span style="color: black;">研发</span>,<span style="color: black;">因此</span>我<span style="color: black;">迄今</span><span style="color: black;">亦</span><span style="color: black;">无</span>用过C语言,后来做数据工作,<span style="color: black;">起始</span>接触Python、R,觉得和C完全不<span style="color: black;">同样</span>,有太多的轮子<span style="color: black;">能够</span>用。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/f3b6559a8d54453191d3bf330f025c4a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=6k4GnArkG2ugGJnISPlXQfxWyNM%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">近期</span>在知乎上看到一个问题,说python不比C简单,不排除这是个钓鱼贴。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/6ef6e576725f45438a0a6a2135b16572~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=ye1NRLAemGzSKcVwSdW7Qat%2FjwY%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">高赞的几个回答,还是蛮有趣,暗讽的比较多。基本意思是提问者属于小白,压根不<span style="color: black;">晓得</span>C的难度。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/8092ec0f013946b4a44ea3b0f4a38c5d~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=ab71CiBms%2FgVQ%2BYMKvrHVUhj5mc%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/6d537bcbd2544ec282108ba67842187f~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=SNAIT7caNeS22ABVhc01hmR%2Becw%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">但某种<span style="color: black;">道理</span>上,这个问题其实是值得讨论的。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">针对</span>95%以上的人<span style="color: black;">来讲</span>,Python比C要简单<span style="color: black;">非常多</span>,但<span style="color: black;">针对</span><span style="color: black;">另一</span>5%深度<span style="color: black;">运用</span>Python的人<span style="color: black;">来讲</span>,Python用起来可能会比C更<span style="color: black;">繁杂</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">为何</span>呢?先<span style="color: black;">瞧瞧</span>Python和C语言的差异。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">前面说过,C语言偏硬件编程,代码更加底层,Python相比C语言进行了封装和简化,类似windows和Linux的感觉。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/a513cca2bf5141fab9e09a6efb634990~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=4t2dWw8mB050Rk1h5Fj%2FGLrKQZ0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">Python把C语言中<span style="color: black;">非常多</span><span style="color: black;">繁杂</span>、晦涩、冗长的功能概念都进行封装简化,<span style="color: black;">例如</span>数据类型、内存管理、错误处理等,本来C语言<span style="color: black;">必须</span>几十行代码能实现的功能,Python几行代码就搞定。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">一样</span>的打印hello word,python只需一行代码。</span></span></p><span style="color: black;">print</span>(<span style="color: black;">"Hello, World!"</span>)
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">C语言<span style="color: black;">必须</span>五六行</span></span></p><span style="color: black;">#<span style="color: black;">include</span> <span style="color: black;">&lt;stdio.h&gt;</span></span>
    <span style="color: black;"><span style="color: black;">int</span> <span style="color: black;">main</span><span style="color: black;">()</span> </span>{
    <span style="color: black;">printf</span>(<span style="color: black;">"Hello, World!\n"</span>);
    <span style="color: black;">return</span> <span style="color: black;">0</span>;
    }
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">很<span style="color: black;">显著</span>看出来python对函数和数据类型都进行了封装和简化处理,让代码更加容易编写和阅读。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">另一</span>,Python<span style="color: black;">持有</span><span style="color: black;">海量</span>的内置库和第三方库,调用起来非常方便,不<span style="color: black;">必须</span>程序员自己重新造轮子,这<span style="color: black;">亦</span>是<span style="color: black;">引起</span>在绝大部分需求上,Python会比C简单<span style="color: black;">非常多</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">那又<span style="color: black;">为何</span><span style="color: black;">针对</span>深度<span style="color: black;">运用</span>python的人<span style="color: black;">来讲</span>,python可能又会比C语言更加难呢?</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">这<span style="color: black;">一样</span>是<span style="color: black;">由于</span>python的封装和简化<span style="color: black;">引起</span>了难,双刃剑的两面性。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">首当其冲的是python的低效问题,<span style="color: black;">由于</span>python高级语言特性,牺牲了速度,不像C<span style="color: black;">必须</span>那样更接近硬件层面。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">因此</span><span style="color: black;">运用</span>python<span style="color: black;">研发</span><span style="color: black;">繁杂</span>项目,必然要优化性能,<span style="color: black;">例如</span>CPython等,这会<span style="color: black;">繁杂</span><span style="color: black;">非常多</span>。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/6366f64c70b642b3bc0a6899a02f345a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723888851&amp;x-signature=1bG8PmfYVAj4hRf6nfOrw2tmH88%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">其次,<span style="color: black;">因为</span>python把<span style="color: black;">非常多</span>底层细节<span style="color: black;">隐匿</span>封装起来,<span style="color: black;">倘若</span>你想进行更深度的<span style="color: black;">研发</span>,会比较困难,代码的<span style="color: black;">守护</span>和质量<span style="color: black;">亦</span>更难管理。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">因此</span>你会看到C语言写的软件能稳定运行几十年没问题,<span style="color: black;">非常多</span>大型软件<span style="color: black;">亦</span>是C<span style="color: black;">研发</span>的。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">但python在这块就比较劣势,<span style="color: black;">例如</span><span style="color: black;">研发</span>性能密集型应用、实时性应用、高并发应用,就<span style="color: black;">必须</span><span style="color: black;">更加多</span>的时间去<span style="color: black;">科研</span>,并不像C<span style="color: black;">那样</span>方便稳定。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">总的<span style="color: black;">来讲</span>,C语言肯定比Python更艰深晦涩,但想要把Python用的炉火纯青,不见得会比C简单。</span></span></p>




nykek5i 发表于 2024-10-17 19:02:56

楼主发的这篇帖子,我觉得非常有道理。

nqkk58 发表于 2024-10-18 03:47:58

同意、说得对、没错、我也是这么想的等。
页: [1]
查看完整版本: 有人说,Python比C语言难?该怎么反驳