
A Python Substitute? I Tried the Best Programming Language You’ve Never Heard Of - yakkomajuri
https://medium.com/better-programming/a-python-substitute-i-tried-out-the-best-programming-language-youve-never-heard-of-9e29cd1893c0
======
yomly
This is the actual blog post title but it is clickbait. Also this is HN -
people have heard of Nim.

I don't want to have to click through to know what the language comparison is.

~~~
arthtyagi
I was actually curious at first and then I was like ah shit here we go again
"NiM : the python killer", it for real is not by any means gonna be able to
replace python given the stark difference in usage atm in addition to Nim's
inadequete marketing and advocacy present right now. Just doesn't add up.

~~~
xiphias2
I feel the opposite: Nim is overmarketed here on HN, just like D.

It's marketed as a modern systems programming language, but I don't see any
benchmark comparision with C/C++/Rust on language benchmark shootout.

As for me I selected Julia from the language benchmark shootout as my to go
programming language, and I'm not looking back (Rust/C++ are a bit too level
for my needs, but I still need performance).

~~~
dom96
> I don't see any benchmark comparision with C/C++/Rust on language benchmark
> shootout.

Funnily enough this is because the author of that benchmark outright refuses
to include new languages such as Nim.

~~~
xiphias2
That's so sad :(

I learned a lot from the benchmarks themselves. Somebody could just fork it if
it's not well maintained, but I know that it's extra work.

------
mreome
The question of it being "clickbait" aside, I find the title a bit odd. I
can’t see any language that "You've Never Heard Of" as being a possible Python
substitute. In my mind, one of the single largest reasons for using Python is
how ubiquitous it is and how large the community is.

Virtually any question or problem I run into with Python's core libraries or
language features is answered in detail by the first Google result. It's
getting rare to not find a reasonably well documented Python binding for any
given library, and many projects have official Python bindings. It's almost
trivial to find an example of how to do virtually anything in Python.

Any language could be argued as an _alternative_ to Python, but very few can
be a _substitute_ for it given the scale of investment and mind-share Python
has.

~~~
rich_sasha
This. Python is a genuine great choice for so many disciplines as well. If I
have a ML project, then need to make a web app around it, and want to manage
my environment, Python is a genuinely great language for _all_ of those needs
all at the same time.

Great as they may be in their own domains, you can’t say that about Julia,
Nim, Matlab etc.

Just JavaScript transpiring seem A bit lacking atm, then it is complete...

~~~
ChrisRackauckas
What's wrong with Julia here? Its webservers and web app packages are pretty
amazing. I just moved everything from a mixture of Ruby and Python over to
various forms of it and have had far less issues. I think the testing and the
"one language stack" culture of Julia leads to more robust software and you
can fairly clearly see it in the general-purpose areas.

~~~
rich_sasha
Nothing _wrong_ with Julia, and likely my knowledge of it is outdated. But my
point is, Python ranks, in popularity, quality and appropriateness, as a top
choice for so many categories of SE. It’s not like a, say, good scientific
programming language with an also surprisingly good web front end. Not sure
you would say that about Julia, for lack of popularity if nothing else.

------
melling
Looks like Nim uses let and var to declare immutable and mutable variables. I
prefer this to var and val in Scala

That’s also how Swift does it too.

Throw in type inference and statically typed languages look much nicer.

Swift uses C style braces, while Nim seems to use white space like Python.

~~~
karmakaze
I wish languages used let to mean a lazily evaluated named expression. Then
you can define all your terms that can depend on other lets and only the ones
needed in the executed code path get executed once.

------
nepeckman
Nim is my "scripting" language of choice for any quick tools I write. Just
today I needed to do some data exploration on a 1 million line CSV file. No
formal data analysis, just needed to understand the shape of the data and
answer a few questions. Writing the script was easy thanks to Nim's nice
syntax and big standard library. My most complex query finished in a minute,
most of my queries took less than 20 seconds to complete. This is all
unoptimized code using the garbage collector and idiomatic language features.
Nim isnt without its faults, but it is a seriously underrated language.

~~~
timothycrosley
The problem with examples like this is that simple FileIO operations are
optimized across all languages. It would likely have similar speed in very
naive unoptimized Python.

Here is an example:

Given `create_csv.py`:

    
    
      with open("output.csv", "w") as csv_file:
        for i in range(1_000_001):
          csv_file.write(",".join([str(i)] * 100))  # creating 100 columns per entry out of a million
          csv_file.write("\n")
    

and `search_csv.py`:

    
    
      import sys
        
      for row in open("output.csv"):
        if "1000000" in row.split(","):
          print(row)
          break
      else: 
        sys.exit("row 1 million not found!")
    

With the first script creating a 1 million line csv with each row containing
100 columns, and the second one being a worse case search (has to make it all
the way to last row, has to search every column). The performance is better
than what you mentioned on commodity hardware, very unoptimized Python code,
and default Python3 installation:

time python3 create_csv.py

    
    
      real    0m3.267s
      user    0m2.589s
      sys     0m0.608s
    

time python3 search_csv.py

1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000,1000000

    
    
      real    0m6.132s
      user    0m5.954s
      sys     0m0.162s

------
arthtyagi
nah man, i've tried Nim. it's meh.

~~~
yakkomajuri
Interesting. Would be cool to hear your thoughts: what was meh about it? Lack
of tooling maybe?

~~~
arthtyagi
yes exactly plus there are some things not about the language itself but the
whole foundation backing it up, it lacks marketing and advocacy. It looks
appealing but given that lack of marketing and popularity, it needs to have A
LOT OF advantages to still be considered a contender in mainstream production
environments which it fails to achieve since it doesn't really have a whole
lot of advantages to it ( I'm just saying there aren't as many to back up for
the flaws of it's foundation ). Hence, I don't dislike Nim at all but I don't
find it good either, I find it alright.

~~~
yakkomajuri
Yeah, I completely get that. Was talking to a core dev today and he mentioned
the limited tooling/ecosystem. It doesn't help when you're a competitor of
either very well-established languages or ones that are backed by big
corporations (e.g. Go)

------
yakkomajuri
Bypass the paywall with this link: [https://medium.com/better-
programming/a-python-substitute-i-...](https://medium.com/better-
programming/a-python-substitute-i-tried-out-the-best-programming-language-
youve-never-heard-
of-9e29cd1893c0?source=friends_link&sk=61b12cfd6456f992013ba61e710efc72)

~~~
jraph
Or just disable Javascript. On Medium, you get a great experience doing this,
because it disables what I call the "progressive degradation" strategy set up
on Medium. This allows the "graceful enhancement" strategy to kick in. See how
images and text render perfectly without JS.

I've already said this here, but progressive degradation is a great strategy
going like this: you start with a sane and nice baseline, and then add crap to
that for supported browsers and configurations.

You can be thankful to Medium for adopting this technique, because if
everybody did that, you'd get a perfect Web by just blocking Javascript on
anything that is supposed to be a freaking document. Please lobby for this.
The team behind Medium might even be secretly doing this on purpose but don't
tell their boss.

~~~
dvfjsdhgfv
I use the same trick, the problem is in this case the code examples don't
work, you need to unblock JS for a moment.

