Deepanshuj
IEEE Student Branch DIT University
6 min readAug 27, 2020

--

C++ or Python

If we consider that every technocrat knows about python and C++, Still what percentage of you actually know the way many versions of C++ and python we are having. Let’s discuss python and C++.

Python

Python Created back in 1991 by someone named Guido van Rossum, Python may well be a general-purpose linguistic communication that stresses readability as its leading feature. From the primary days of development, Python was intended to be as simple to use as possible. Simplicity is really what it’s known for — Python utilizes a plentiful amount of whitespace to form its code easily readable, thus providing a pleasant and simple learning experience. When discussing Python vs. C++ from now of view, C++ includes a more complex syntax. as an example, all C-like languages use curly brackets and semicolons, while Python depends on the indentation. Another important feature of Python is that it’s an interpreted language, meaning that the Python code isn’t converted to machine-readable at runtime. while the use of Python circulates around the easy syntax aspect, Python is involved in some high-importance tasks

C++

C++ could also be a general-purpose language usually involved within the event of big and complicated systems. This language is that the foremost portable out of the whole circle of programming languages. When comparing Python vs. C++, Python follows a rule of “write once, run

anywhere,” which means that one code will work on all operating systems.

However, the C++ code should compile on each OS before it can execute. The biggest difference within the discussion of C++ vs. Python is that the C++ ASCII computer file has got to become code. Python follows a special tactic because it’s interpreted. However, the interpretation of code is typically slower than running code directly on the hardware

Uses of Python

· Machine learning (ML) with Python improves many industries like insurance, retail, banking, aerospace, and business services. ML could be a wonderful option for locating insights in an exceedingly specific field and making predictions.

· Most of the data-analysts choose Python as their main linguistic communication. It helps to handle huge amounts of knowledge within the foremost cost-effective way. Python also manages data, analyzes statistical information, improves data visualization, and makes predictions in specific fields.

· Python is additionally an energetic member of the backend web development. as an example, Django is one in all the frameworks which will facilitate your to use Python in web development. it’s possible to create a web site by using raw Python, but that’s rare.

· you cannot use Python code in frontend development. However, some tools can facilitate your transpile Python code to JavaScript (which runs on the browser).

Where is C++ used?

C++ is closer to the hardware. Therefore, C++ produces most of the embedded systems around. By embedded systems, we mean smartwatches, medical machines, IoT sensors, etc.

C++ plays part within the event of applications like servers and microcontroller programs.

C++ is that the leading language for 3D, multiplayer, or other forms of game development. it’s powerful enough to make such elaborate games as CounterStrike, Doom, and Red Dead Redemption. for instance, even the framework Unity is written in C++ although its users apply C#

The Python version release dates are as follows:

· Python 1.0 — Jan 1994

· Python 1.5–31 Dec 1997

· Python 1.5.2 — April 1999

· Python 1.6–05 Sep 2000

· Python 2.0–16 Oct 2000

· Python 2.0.1–22 Jun 2001

· Python 2.1–17 Apr 2001

· Python 2.2–21 Dec 2001

· Python 2.3–29 Jul 2003

· Python 2.4–30 Nov 2004

· Python 2.5–19 Sep 2006

· Python 2.6–01 Oct 2008

· Python 2.7–03 Jul 2010

· Python 3.0–03 Dec 2008

· Python 3.1–27 Jun 2009

· Python 3.2–20 Feb 2011

· Python 3.3–29 Sep 2012

· Python 3.4–16 Mar 2014

· Python 3.5–13 Sep 2015

· Python 3.6–23 Dec 2016

· Python 3.7–27 Jun 2018

· Python 3.8–14 Oct 2019 Some of the most recent final releases of versions:

· Python 2.4.6–19 Dec 2008

· Python 2.5.6–26 May 2011

· Python 2.6.9–29 Oct 2013

· Python 2.7.10–23 May 2015

· Python 2.7.13–17 Dec 2016

· Python 3.5.3–17 Jan 2017

· Python 3.6.10–18 Dec 2019

· python 3.8.2–24 feb 2020

The C++ version release dates are as follows:

· C++98 (ISO/IEC 14882:1998) — Oct 1998

· C++03 (ISO/IEC 14882:2003) — Aug 2003

· C++11 — Aug 2011

· C++14 — Aug 2014

· C++17 — Dec 2017

· C++20 — Upcoming release

C++98

Work on C++ began back in 1985. However, the language was officially standardized in 1998. Hence, the initial version was called C++98. Although its functionality was primitive compared to what we’ve now, C++98 supported basic I/O streams and templates. the standard library (STL) contained Strings, algorithms, and containers (arrays, queues, stacks, etc.), among other things.

C++11

With the introduction of C++11, the language shifted its focus to functional programming. there are many latest features that, in a sense, evolved the language. variety of them could also be seen below:

Shared and unique pointers Null pointers

Automatic type deduction Lambda expressions

New built-in literals in C++14

In C++ 14, there are some new built-in literals including those for binary numbers, C++ strings, complex numbers, and time units. Let’s have a look at the overview of this new concept. We must keep some special rules in mind.

There is one main difference between built-in literals and user-defined literals: built-in literals have no underscore. For the first time, in C++14, string literals are supported. In the past C++ only supported C-string literals, meaning that we had to always use a C-string literal to initialize a C++ string. Time literals are also very convenient since they implicitly know their own unit, and also support basic arithmetic. Time literals are of the type std::chrono::duration.

Conclusion:

Python is on the order of between 10 and 100 times slower than C++ when doing any serious number crunching. There are many reasons for this, the major ones being: a) Python is interpreted, while C++ is compiled; b) Python has no primitives, everything including the built-in types (int, float, etc.) are objects; c) a Python list can hold objects of a different type, so each entry has to store additional data about its type.

These all severely hinder both runtime and memory consumption.

This is no reason to ignore Python though. A lot of software doesn’t require much time or memory even with the 100-time slowness factor. Development cost is where Python wins with a simple and concise style. This improvement in development cost often outweighs the cost of additional CPU and memory resources. When it doesn’t, however, then C++ wins.

References:

https://stackoverflow.com/questions/801657/is-python-faster-and-lighter-than-c https://www.bitdegree.org/tutorials/python-vs-c-plus-plus/ https://www.educative.io/courses/cpp-fundamentals-for-professionals

--

--