Top 5 Reasons to use PythonsteemCreated with Sketch.

in #technology7 years ago (edited)

486px-Python_logo_and_wordmark.png


So I have been doing some market research with some software I wrote in Python, and I despite the fact that I have been a long time Python user, I just grew to like it more and more, so I’ll be giving you a few reasons why you should only code and use Python based software, if you can.

I mean the comparison is astronomical. We already know the banes of closed-source non-transparent softwares how it can have backdoors or bugs that are left unattended by lazy developers and undiscovered by investigative developers due to their closed source nature, really risking everyone who uses that software, but it goes beyond that. It’s not just the open-source nature of it, but there are many other reasons why Python is better than anything else.


1) Python Runs from the Source

Python is really unique compared to any other programming language (that I know of) in the sense that it completely runs from the source. Sort of like a “bat” file in Windows, but it’s actually a full programming language not just a script, so it can interact with anything on your computer (of course through admin access only), so you can code anything in it from a simple script to an entire video game or other software.

The problem I have with programming is always the assembly, whenever I try to use an open source software I have problems with compilation, they all need all sorts of dependencies and right configurations. It’s just a pain in the ass.

With python it’s just 1 line: python3 filename.py that’s it. Nothing complicated. Even your grandma can code software now.


2) Python is Aesthetic

Python is aesthetic, compared to C or C++ which is full of {} brackets that you get lost in it, and in some cases if you place the brackets wrongly, it totally gives you other results. Or in C/C++ you also have to put a ; at the end of every command, which can also be mistaken or wrongly used, so the risk of a mistake and a bug in C/C++ is much higher, and it’s a much uglier code syntax.

Pascal I didn’t use that much but it’s even more ugly in my opinion. We did some Pascal early on in my finance past job, but we quickly switched to C/C++ around early ~ 2000, nobody uses that ugly language.

But Python, and the Python software or package whatever you call it, has more checks and error catchers built in it, so the probability of mistakes and errors is much lower, plus you can debug the code much much easier.

The Aesthetics part is in the sense that you don’t have to put the code full of {} and ; but you have to still be careful with spaces and tabs since it’s the alignment of the code that counts here, but I think it’s harder to mess that up if you are careful, than missing a ;.


3) Python is Easy

If you are familiar with C/C++ structure, then you can easily code in Python. There are some specific syntaxes that I am still learning, thanks to StackOverflow.com for existing. But it’s literally very easy to code, all you need is just the Python package software installed which is installed in most Linux Distros by default, and a text editor, like Gedit.

I make all my code in a text editor, literally, no need for fancy extra software, which you would need if you want to do GUI code, but I just make console scripts, more efficient and quicker for what I need.


4) Python is Free & Open Source

No need to pay anything it’s free, it’s under the PSF license, which is based on GPL but it’s actually not even copyleft, so the code of the package itself can be modified without publishing the source code, if you’d want to fork the core software itself.

But using the language itself is totally free, no need to pay like 100$ for a fancy, shitty, coding tool, that is closed source on a closed source OS, so you don’t even know what software you are building if the tool you are building it with is closed.

The code is also free, so it’s one of the most robust, quickly evolving, and bug tested, languages out there. Now it went through some issues with the 3.x.x update, but I heard it’s getting better now so it’s not a big deal.


5) Python is Secure (with proper modules)

The language itself is secure and the code you write can be cryptographically verified. I mean the code itself is just a text file, that can be hashed and compared to other version of it. So any type of tinkering can be detected, as opposed to closed source shitty code with closed source compiler, there is no way to know if the executable contains a virus even if your source code is clean, if the compiler itself is compromized.

So all closed source software could have hidden backdoors in it, even if the developer is honest, if the compiler itself is compromized.

With python this issue is not a problem anymore.

Python doesn’t support IP features because of this, so you can’t make closed source implementation for this reason, since the code runs from source. However I think there are 3rd party tools that can obfuscate the code and turn it into a binary .exe or other .bin executable file, if you are working on a commercial software and want to protect your IP, but that defeats the purpose isn’t it.

Also Python has secure module attachments like the ECDSA module, and guess what, one of the most popular Bitcoin wallets: Electrum and Electron Cash are totally written in Python and use exactly this module for their crypto functions.

So if you trust Electrum, which many people do including me, then you have to trust Python and their crypto modules as well. It’s provably secure in the language/software context.



Sources:


Upvote, ReSteem & bluebutton


Sort:  

Thank for the great information. I am new to Python. So far, don't like the indentation rule of Python, but trying to get use of it. For short code it's not an issue, when the code is long, I am not sure whether it will be a problem or not.

Depends how you organize your code. You can just decentralize the code by writing 1 class and let that be 1 file, and then you just import that class into another file. So each separate "chapter" of the code can be in a different file, much easier to manage.

Certainly cramming everything into 1 file and then having 1 extra space somwhere that can mess up things is risky.

So for code longer than 2 A4 papers I think the best thing to do is just use multiple files, especially if you code alone and have no bug-tester friend.

interesting discussion here :-)

Thanks a lot.

You hit some good points, but missed something pretty important, depending on what you're developing: speed. Python is excellent, but it's much much slower than c/c++.

This won't matter for most programs, but if you're coding anything that does heavy lifting, c/c++ might be preferred, even though I'll be a pain to do.

Not like that will matter as much as personal computers get faster, though.

Yes I agree Python is slower natively, but there are some packages that make it more efficient. For example I am now using the NUMPY package by default for array manipulation.

I have tested it, the NUMPY package is about 60% faster than the default array structure. So that helps.

There are also tricks to speed up the code, for example in Python3 you don't need to transform a variable to float, you just declare it like this variable=1.0 so that is automatically a float.

I have found that if you transform a variable into a float with float(x) command it might make it 50% slower.

I am doing research now with an intensive script I wrote, so believe me every bit of efficiency helps, but I guess I should try it in C too to see whether it will speed it up even more.

Great post. Follow me and Resteem @ SBD 0.001 by @jossylink

Can you stop at any chosen line and look for the values of each variable ?

Well not with the basic text editor, but I guess if there is some more sophisticated software out there for writing Python code, I guess I could.

I write my code in a basic text editor and just print out my values for debugging.

Delphi of Borland had this feature in their interactive Development Environment (IDE) .
For big SW projects it is essential, we knew it with the name: interactive debugging aid.

Are there (reliable) cross-compiler s that take your python code and generate (compiled C/C++) executables ?

You don't need executables that is the point. Everything runs from the source, both on Windows, Mac and Linux I believe.

So you just write into the console python filename.py or make the file itself an executable, this is done on linux by right click, and there setting it as executable and in the open with tab setting it as run so it becomes an executable. I don't know how on other OS it's done, I'm a Linux user.

Of course for GUI based code, there is the QT package:

Coin Marketplace

STEEM 0.19
TRX 0.18
JST 0.033
BTC 88172.86
ETH 3116.36
USDT 1.00
SBD 2.77