DEV Community

Discussion on: Where does Python Shine Over Node?

Collapse
 
pencillr profile image
Richard Lenkovits

More of a python vs javascript comparison here. Backstory: I'm using node for my personal projects and webapps, and I'm using python (+bash) in my DevOps dayjob.

I'd say that after you learn it, you'll see that python is a much more elegant and robust language as it didn't have to endure the whims and fancies of the web world for several years - compared to javascript. A few years ago I picked up javascript after python, so I was the other way around, but here's a few things I felt python was better at:

  • Great native functional style tools like list comprehension, and generators
  • No undefined and null just None
  • A great type system with lists, sets, tuples, dictionaries. ( Javascript types are not so versatile. No mutable/immutable distinction, no built-in hash-table support, confusing implicit type evaluation. )
  • No semicolons. Transparent code structure through indentation based function boundaries.
  • No mess with let, const, var, just a very clean function scope (global is heresy).

  • The only downside I see is maybe the package management with pip and virtualenv, which could be a bit hard to grasp and setup at first. But after that I thing generally python modules are safer compared to the dumpsterfire at npm. :)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited
  • Not sure if Python can make anything immutable, though -- unlike top-level const
  • Although Python has function scopes, Python's loop famously leaks its scope.
  • List comprehension / generator expressions are indeed nice and maybe performant, but they can be hard to read sometimes. Otherwise, I never like how we write map(), filter().

Otherwise, you are right that Python is generally safer.

Personally, I don't like Python anymore, due to its namespace full of common words by default...