DEV Community

loading...

My love hate relationship with python

eduardfaus profile image Eduard Faus ・2 min read

Alt Text

Introduction

I don't know if I love python or hate it, and I'm not alone. I have heard this from many developers for different reasons. In this article I will mention my history with python, as well as why I hate it and love it.

Why I love it

The code readability

Lets address the elephant in the room python is basically Pseudocode. This is amazing like seriously python changed my life. I use JavaScript as my main programming language and using python for the first time felt amazing. I would literally type something that looked like English and it would work.

List Comprehension

Continuing the thought of code readability list comprehension simplifies my algorithms by so much and has saved me so many lines of code. An example would be:

names = ["Eduard","Ed","Emily","Max","Ben"]
def namesThatStartWith(x, y):
  return [i for i in y if i[0] is x]
print(namesThatStartWith("E", names))
Enter fullscreen mode Exit fullscreen mode

this code return the names that start with a specific letter in a list. In python its super easy to read and done in little lines of code.

Community

Another reason i love it is it's community, libraries, and applications like ml and web servers.

Why I Hate It

Speed

It's a well known fact that python is slow like very slow. It's okay for playing around but for some programs you simply can't use python.

Control

With programming languages like c/c++ and rust you have way more control of the code and computer.

Simplicity

It feels like it was made for beginner and something inside me makes me want to not like it, but I do which is why python is so weird.

My history with python

The first time I tried learning programming it was python, but I barely did anything with it and later on started programming with JavaScript. I really disliked python at that point until I started playing Code Wars. I really enjoyed Code Wars and tried using python on it. I saw how it decreased the lines for my solutions and increased its simplicity. It made everything so much easier. That changed my perspective on it and now I love python.

Discuss

So how do you feel about python talk about it in the comments.

Discussion

pic
Editor guide
Collapse
ahferroin7 profile image
Austin S. Hemmelgarn

One of the big things I love about Python is the comparatively comprehensive standard library. Many things that would need dozens of extra dependencies in other languages are just part of the standard library in Python. Hell, you can even write backend web app code without any external dependencies if you want to. This, overall, makes it very attractive for one of the big things I personally use it for, which is scripting system administration tasks.

As far as the speed, the bigger issue IMO is how hard Python makes it to do concurrent code. Things have kind of gotten better with asyncio, but when you need actual computational concurrency instead of cooperative multitasking, Python just can’t do it efficiently, because it can’t handle concurrent thread execution, and the overhead involved in multi-process concurrency is just way too high. If it could do concurrency efficiently, then Python would be fast enough for most usage.

The biggest issue IMO is the handling of project dependencies. Python is kind of built around the assumption that everybody can just get along and always use the same versions of every library they care about without needing special local dependency packages for each program. Avoiding this is one of the big things I love about Elixir (and one of the few things I actually like about JavaScript).

Collapse
eduardfaus profile image
Eduard Faus Author

Very well said thanks for reading my article. That was some very incite full comment. I mostly do javascript/python and sometimes java. Do you recommend elixir. (ps. I would really appreciate if you could react to the comment so more people can see it)(if not its OK I understand). Well thanks for the comment i hope this find you well and you have a great day.

Collapse
ahferroin7 profile image
Austin S. Hemmelgarn

In general yes, I feel that Elixir is a great language to learn. It has a very good official tutorial, very good documentation (on-par with the documentation for the Python standard library), the bundled tooling (primarily mix, which bundles compilation, releases, testing, dependency management, and many other things into one easily extensible package) is very developer friendly, and the language itself is not particularly difficult to learn as far as FP languages go.

Some of the core concepts inherent to the runtime environment take a bit of getting used to (truly immutable data, processes/applications being separate from the OS-level concepts, serialization through by routing calls through single processes instead of locking, etc), but once you get used to that, it’s a remarkably powerful platform to build off of due to the general benefits of underlying Erlang platform (namely, it makes it easy to write soft-real-time highly concurrent code with a high degree of reliability).

The main downside to Elixir is that the package ecosystem outside of a couple of big names and their dependencies looks a bit lackluster due to the ‘don’t mess with it if it works’ mentality that is much more common in the Elixir/Erlang world, and it’s often not unusual if you need to work with some niche technology that you’ll have to write bindings yourself. OTOH, there’s zero-effort interoperability with existing Erlang libraries and other BEAM languages, so you can sometimes get lucky and find existing libraries there. It’s also not as highly in-demand as some other languages, though big companies do use it (Discord and change.org are both powered by Elixir, among other major companies) and it greatly simplifies the process of learning Erlang, which is also used by a number of big companies (most of the major telecom companies in the world use Erlang rather actively (that’s kind of what it was designed for originally), as does Nintendo’s online multiplayer network).


PS: If you’re interested in web development specifically, I would strongly suggest looking into the Phoenix Framework, which is the web app framework for Elixir. It makes real-time web applications blissfully simple compared to trying to do the same thing in Go, Python, or Node.

Thread Thread
eduardfaus profile image
Eduard Faus Author

Thanks I just researched elixir and I am learning the basics that was nice of you also i got confused I meant react to the article not comment. Anyway thank you for your knowledge elixir seems like a great programming language.

Collapse
eduardfaus profile image
Eduard Faus Author

Please comment and discuss . I personally love python and think its great to use.