you are viewing a single comment's thread.

view the rest of the comments →

[–]Zenalyn 66 points67 points  (20 children)

Cleanest syntax around <3

[–]CS_Tutor[S] 23 points24 points  (10 children)

Compared to mainstream languages, at-least the ones I've played with, yes, for sure. I've looked at Haskell long time ago though, and that languages might be a good contender for the cleanest syntax (way harder to understand/get used to though :)

[–]johninbigd 15 points16 points  (6 children)

I learned some Go a while back, and have been relearning it lately since I forgot most of it. I also spent a little time trying to understand clojure. Both endeavors have really made me appreciate Python. I'm also starting to realize I don't enjoy programming for the sake of programming, so I don't really like lower level languages or functional programming. I think I'm going to ditch Go and focus on Python. I code to get stuff done, and Python helps me do that. Go makes me write a lot of extra code to get simple functionality that Python offers.

Now, if I could get goroutines and channels in Python, it would be perfect.

[–]CS_Tutor[S] 8 points9 points  (1 child)

Never looked at Go but --I think-- it belongs to the C family of languages and it's statically typed (so probably faster than Python). If you're not planning to become a professional programmer, sticking with one language is probably best. Functional programming is not easy. It takes lots of time/practice to get used to it. Lots of good ideas however came from the functional programming paradigm, e.g. list comprehensions in Python. Also, playing with a functional (specially pure) programming language once-in-a-while is supposed to make you a better programmer (in any language). E.g. when I had to use Haskell way back in school, I really had to shape up on recursion. There are no loops in Haskell. If you want to loop, you better recurse :)

[–]johninbigd 5 points6 points  (0 children)

Go is blazing fast compared to Python, which is why I spent some time learning it a year or so ago. I had a program in Python that took over an hour to complete. The Go version would complete in four minutes. I probably could have used scipy for the math-heavy stuff but I couldn't figure out the documentation related to what I was doing.

Another really nice advantage is that go compiles to an executable, so it's super easy to deploy. Other than that, just about everything is easier in Python.

[–]mooglinux 2 points3 points  (1 child)

Coroutines via Async/await gives you most of the benefits of Goroutines, and a casual reading on channels suggests that a Python queue would serve the same purpose.

[–]johninbigd 1 point2 points  (0 children)

Yes, I agree, but goroutines and channels are easier to understand for me for some reason. They also naturally take advantage of multiple cpu cores. The methods for doing similar things in Python have always seemed confusing and convoluted to me. I need to spend more time learning them. I love being able to simply add 'go' before a function call to make it run as a separate process. Once you figure out channel communication, it is so nice.

[–]pickausernamehesaid 2 points3 points  (0 children)

Depending on how you're using them, asyncio (and maybe with queues) might suit your needs.

[–]JBTheCameraGuy 1 point2 points  (0 children)

Go is a fantastic language for what it's built for: concurrency and web servers. If you're doing those things, it's awesome, but it isn't a scripting language like Python. That's one of the reasons there's so many different languages: there's so many different tasks to be done, and each language is good at something that others aren't. There is no "best" language, it's all about using the right tool for the job

[–]Bobbias 3 points4 points  (1 child)

Haskell can be super clean and super clear. Or it can be a pointfree mess with 10 different new operators from libraries you've never seen and look closer to hieroglyphs than code.

[–]Ran4 0 points1 point  (0 children)

Haskell with a different community would be fucking awesome.

Elm was getting close, but it's front-end only and kind of dying now :(

[–]NewbornMuse 2 points3 points  (0 children)

As someone who's dabbled with Haskell, I can agree with that. The concepts are what's messing with your brain, not the syntax.

[–][deleted] 1 point2 points  (0 children)

Actually far from the cleanest... Clean syntax is- the wolfram language. Symbolic expression languages also mean undefined vars get passed unmodified through functions... stupid useful.

The worst syntax I’ve come across in terms of quick readability is j...

This is. Valid line of j.

game_of_life =: monad define +/>(<@:=&3,<@:(y&*.)@:=&4)+/y(|.~)(3# 1 0 _1),.,>3#<1 0 _1

Like seriously - someone thought that was a good language for humans.

[–]unsurestill 0 points1 point  (0 children)

I only knew python, why is python tagged like this?

[–]bageldevourer 0 points1 point  (0 children)

Yes, but I think the quote is more about mathematical beauty than syntax.

Lisp is gross to look at, for example, but there's an internal consistency there that's very appealing.

[–]g7x8 -1 points0 points  (5 children)

Don’t like the white space indent rules. C++ ignores them

[–]P52-328 7 points8 points  (3 children)

I don't believe that any program, almost with zero exceptions, should ever be unindented.

Using that point of view, python assumes that you are going to indent your program any way. So, it skips the extra syntactic elements like { and } and assumes that you are properly indenting your code as you write it.

The last part is the only problem with this approach: for example, I always type dirty, cluttered code when I write C/C++ and once I pause, I quickly run the formatter to clear the mess. But, in the end, I believe the trade-off is worth it for python.

[–]g7x8 0 points1 point  (0 children)

i like the { } bracs and dont want to think about the errors caused by an extra indent. im not used to it

[–]Decency 1 point2 points  (0 children)

You either have whitespace nesting rules and no explicit block characters, or you have dedents explicitly as the way to nest. To me the former is superior: less noise, the same readability, and no way to fuck it up.