Python 和 C++ 如何选择?
大三狗,想要大四找到一线城市工作,主要方向是linux下编程,有linux c编程经验,最近一直在纠结是学c++还是python,请求各位解答,小弟拜谢…
回复内容:
有等答案的功夫python就学完了。 基本上只要是靠谱的公司都不是看你现在会什么语言才要你的。基本上找工作的时候也别抱着『我会XXX』就妄想这辈子只靠这个语言工作。 两个都学,并且还要学Python的C API。这样就可以任意互相调了。 28原则吧 80%精力学习c++ 20精力学习一门脚本语言
主要看楼主以后方向吧 如果是网络安全python肯定需要 如果是游戏可以先学lua
光学习语言是不行的 多看看优秀的源码的 openresty skynet stl
对于python可以先过书 几天搞定一个高级话题 如装饰器 迭代器 协程 元类
学一门学累了 看看csapp 算法导论 挺好 要完成一些成规模的项目,软件架构与性能都必不可少。C++正是为此而生,在尽量不牺牲性能的情况下,提供高层次抽象所需的功能。毕竟C所缺少的命名空间、高级数据结构等,使其完成大规模项目是有一定困难的。
不过C++并不是解决该问题的唯一方案。很多其他方案并不专注于同时确保两点,而是将目标集中于更好的软件架构,以及可以接受的性能。Python、Lua等很多语言都是如此。而同时,对于要求性能较高的部分,或者与系统结合紧密的部分,则是交给C模块去处理。这样的思路对大型项目是很有利的,架构方面因为有高级语言的支持而得到了更好的抽象,更容易实现复杂的逻辑。而循环次数较多的部分则交给C去处理。尤其是引入高级语言后,可以迫使人们将传递的数据交给高级语言,而不是C里随处使用全局变量。
所以,以实用的角度讲,Python+C是更好的选择。另外就是C++为了寻求性能与架构的折中而不得不引入很多概念,这些概念使得C++比C要复杂很多,同时其对架构的支持能力却又比高级语言查一截。
总的来说,我的建议是:
1. 学Python,反正很快
2. 学好C,结合具体的系统与函数库
3. 学Python与C结合的方法,比如Python的C模块、Cython、Swig等多种方式
4. 学一点C++语法,毕竟还是有一定概率会用到C++的库,但不要在那些奇怪的C++功能上浪费时间 语言有什么用处?不依附平台、需求和project,语言没有任何价值。
所以不要纠结什么c++、ruby、python、php之类的该如何选,要看你的职业规划、看你的需求和项目。 由c++入python易,由python入c++难 “人生苦短,我用Python”。不过,不要浮躁。
---------------------------------------------------------
语言只是做事的方法,你要专注于要做的事情本身。你应该根据实际需要选择合适的技术去学习。如果是想做网站后台,做爬虫,做系统管理……肯定python更好。如果想做游戏,做操作系统级编程,显然c++好很多。
而且,python和c++并非水火不容。两者都是c语言系的,基本语法差别不大,而且在python中的关键部分可以嵌入c/c++/java程序片段。没记错的话,python也被称作一种“胶水语言”。
-----------------------------------------------------------
从笔记本上摘几句相关的话供参考:
- 『你不应该“嫁”给任何特定的技术,而应该有足够宽的技术背景和经验基础,使自己能针对特定的情景选择好的解决方案。』——《程序员修炼之道》
- 『我永远不会用自己的技术来定位自己,而是用我已经做过的和我将要做的事情来定位自己。技术只是一种做事的方法。』
- 『软件开发界有很多这样肤浅的专业人士,这些人以“专业人士”为借口,只知道一门技术。』——《The Passionate Programmer》
- 『身为合格的程序员,扎实的基础+快速学习能力才是你最可靠的武器。至于何种技术,别担心,不过又是一种微风。』
- 『程序员就是程序员,写得出程序就是程序员。程序员不要在自己脑门上加太多修饰,什么C++程序员,什么Java程序员,什么Windows程序员,什么Linux程序员,这些加了修饰的程序员,其实不容易存活的。』
- 『学编程有点像修炼,心静神宁可以让学习更有效率,浮躁要不得。……不要贪多嚼不烂,一定要精于某一方面。』
- 『学以致用』
- 『学习是一辈子的事,不用着急。』
C和C++都有“开发人员过多精力放在人机对话上”的问题,而python好一些,代码逻辑密度更大,OO也比C++更容易。 语言不是女朋友,你可以有两个的~

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Golang is better than Python in terms of performance and scalability. 1) Golang's compilation-type characteristics and efficient concurrency model make it perform well in high concurrency scenarios. 2) Python, as an interpreted language, executes slowly, but can optimize performance through tools such as Cython.

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.

Golang and Python each have their own advantages: Golang is suitable for high performance and concurrent programming, while Python is suitable for data science and web development. Golang is known for its concurrency model and efficient performance, while Python is known for its concise syntax and rich library ecosystem.
