learn Python

Should You Learn Python After Learning C?

April 15, 2019 Posted by Programming 0 thoughts on “Should You Learn Python After Learning C?”

Should you learn Python or another language besides C++, the vaunted systems language? Or, are you supposed to be above stooping down to an abstracted language? Oftentimes, surveys and polls pigeon-hole developers into categories based on the language that they have the most expertise in.  We sometimes think of developers as code warriors who only choose to wield their preferred language in the development environment. In doing so, we severely misunderstand the role a developer plays when it comes to building software, the keyword being “building.” Developers are more like construction workers and plumbers. Several tools are required to construct a building, and several more tools are required to repair it.

The same applies to the development environment. A C++ developer will be much better served if he could prototype software using a language that only takes a few minutes to write rather than using C++. Python is an example of a language that is great for prototyping because it’s a language that is highly legible. The point of mocking software is to quickly represent a bare bones model of the future software. There is no need to focus on optimization and garbage collection. That would drain precious development time. Python’s dynamic typing and automatic garbage collection removes the overhead found in C++.

So, if you learn Python or another dynamic scripting language will add another tool to your developer tool belt. You will find yourself spinning up an app using Python to quickly test the viability of an idea before deciding to invest time in building a fully-fledged app with C++. There are more benefits to learning Python that other developers have pointed out. We’ll list their reasoning behind why you should learn Python below.

1.

An example I can give[as to why you should learn Python] is something I had to do for work recently. Various statistics for several systems in a large distributed network had to be gathered and collected on a central data analytics tool in .json format, which was easily implementable with Python. I later added functionality to send alerts to an internal chat system, the API of which required sending the alert as a POST request, which only took a handful of lines more.

Additionally, I have used the Flask micro framework for web hosting. It’s very fast to set up!

These aren’t perfect examples by any means and are certainly achievable with other languages. For me, Python seemed like the simplest option given what needed to be done and how quickly it needed to be implemented.

 

2.

Matrix multiplication in numpy. Writing convolutions and manipulating images would be so tedious in many other languages. You wanna multiply matrix A by vector B? Just write A*B instead of some variant of A.MatrixMult(B) or MatMult(A,B) or anything else that looks vastly different from the linear algebra you’re trying to use.

Basically you won’t realize the extra mental strain that a lot of languages put on the programmer until you try python. After knowing 2-3 languages it’s not even that big of a task to pick up python, so you might as well add another tool to your toolbox.

 

3.

Python has a literal ton of libraries and whatnot that can make some tasks really easy. The coding syntax and structure is less intense compared to something like Java. I’ve heard that things like scraping data are easier with python. Pretty sure there was a dude who set up a way to order pizza via python and it only took the user a very small amount of code.

 

4.

[Logging is simple]

Here’s a simple example.

Whenever I write a new Python script, the first thing I do is write the command line parsing code and add logging. This is trivial using the argparse and logging libraries that are included as standard, and usually takes about 5 minutes.

Whenever I write a new program in C++, those are also the first things that I tend to do, and it almost always requires me to go find decent third party libraries, figure out the best way to include them in the project (there are still no good, easy solutions for managing 3rd party libraries in C++), and integrate them into my build system. This usually takes about an hour.

 

5.

Well for my experience at least, working with raw data files in Python is pretty straightforward (e.g txt, json) compared to like C or Java as it provides data structures like list or dictionary which can be really easy to used. For example I can access a string like a list (or array in other words) or json object like a dict.

Python has some powerful syntax too. One thing I can think of is list comprehension. Another one is optional arguments for a function or method (args and kwargs)

Another thing I think make Python popular is its interpreter. You can easily test some syntax or the behavior of some codes on the cmd window though it makes the execution speed slower, but as some guy above said its pretty unnoticeable

 

6.

One thing that Python does faster is prototyping. If I’m writing some one-off task to, say, parse some data and print some results, Python is much faster to write because it’s dynamically typed and has none of the boilerplate of the above languages.

Programmer time is expensive, so anything that allows me to do a couple hours of work in 30 minutes is a godsend.

 

Conclusion

 

With all that said, the decision of whether or not to learn a new language should hinge on the value you see in the language. A developer is always taught to constantly keep up with new technologies, but new technologies should serve the developer rather than serve as an extra item on a resume. Learn Python if you’ve been tasked with having to model data for presentations or mock ups, because it will save time. Otherwise, continuing to gain experience in the language you’re most fluent in may provide more tangible results.

 

Please follow and like us:
0