3 ms·
> i continue to not understand why anybody likes python the language Here are some reasons why I like it: It's cleaner to read because there aren't curly brac
by pdonis 8y ago
> i continue to not understand why anybody likes python the language
Here are some reasons why I like it:
It's cleaner to read because there aren't curly braces and semicolons cluttering up the code.
It's cleaner to write because the expressions are simpler and look like something readable instead of line noise.
It has a REPL, so it's easy to experiment.
It doesn't force me to write boilerplate code, such as types for every variable declaration or everything having to be a class or huge amounts of scaffolding just to write "Hello, world!".
I'm sure I could think of more, but those are what come to mind on the spur of the moment.
- nikofeyn 8y agof# (and also ocaml and sml) have all those and much more. they are much more consistent and principled in their design, which makes things simpler to understand. for example, in all three languages above, expressions are much easier to understand because they always return a value. this makes code easier to reason about. this is not true in python. the languages i mentioned do have static typing but they have type inference. so you get the best of both worlds. you do need to type annotate at some points to clarify things, but this isn't a problem as it documents to both the user and compiler. given your above reasons, you owe it to yourself to learn an ml. there is the programming languages course on coursera by dan grossman, which uses sml in the first part, and the ocaml mooc just started where you still have time to register and complete it. https://www.coursera.org/learn/programming-languages https://www.coursera.org/learn/programming-languages https://www.fun-mooc.fr/courses/course-v1:parisdiderot+56002+session03/about https://www.fun-mooc.fr/courses/course-v1:parisdiderot+56002...
- pdonis 8y ago> f# (and also ocaml and sml) have all those and much more F# has curly braces. Also, as you say, it requires some type annotations. I see that F# has a REPL, but it seems bolted on as an afterthought instead of being an integral part of the language. (Also, it's not clear whether the REPL is available in Mono on Linux. I am allergic to Windows and anything built by Microsoft.) > expressions are much easier to understand because they always return a value. this makes code easier to reason about. this is not true in python Huh? Python expressions always return a value. Perhaps what you mean is that Python also has statements, which do not return a value, whereas these languages do not--everything is an expression, as in Lisp? > you owe it to yourself to learn an ml I don't owe it to myself to learn anything unless I decide to. I wasn't trying to convince anyone else to use Python; I was just giving reasons why I like Python. Please extend me the same courtesy when you talk about things you like about your favorite languages.
- nikofeyn 8y agookay, f# has curly braces. but not in the sense of other C-like languages like c++, java, and c#. they are primarily used for sequence expressions and computation expressions like async. > I see that F# has a REPL, but it seems bolted on as an afterthought instead of being an integral part of the language. (Also, it's not clear whether the REPL is available in Mono on Linux. I am allergic to Windows and anything built by Microsoft.) well that first sentence is simply not true, and i don't know what gave you that impression. f#'s repl, f# interactive, is available on linux through mono and will soon be available through .net core. i can't help you being needlessly allergic to a major operating system or company. f# came out of microsoft research. > Huh? Python expressions always return a value. they do? take: def test(x): "something" so what does test(2) return? > I don't owe it to myself to learn anything unless I decide to. I wasn't trying to convince anyone else to use Python; I was just giving reasons why I like Python. Please extend me the same courtesy when you talk about things you like about your favorite languages. i don't know why you're upset. i am not for sure where i was discourteous. i didn't mean anything by my statement other than to check out the languages and courses (the coursera one is very good). if those are your reasons for python, i just thought you would honestly like an ML-based language. i just used "owe it to yourself" as an expression, which apparently came out wrong through text. of course you don't owe anyone anything. i was just making a suggestion.
- codexon 8y ago>>> test(2) is None True
- nikofeyn 8y agoi guess that is true in python3 but it is not in python 2.7.
- xapata 8y agoFalse. You're just not familiar with how the REPL works. >>> None >>> print(None) None In the future, you might want to refrain from strong criticism of a thing you're not familiar with. That habit leads to all sorts of -isms.
- grumdan 8y agoThese are good reasons for why people might prefer python over other imperative languages, though basically all these points also apply to Haskell/OCaml/F#/etc., though some people would still say that a lot of things there look like line noise. I think the GP's point was that functional languages give you similar benefits, but with more uniform and disciplined behavior of many language features. Why FP is not more widely used compared to imperative language is another topic though.
- tracker1 8y agoI can only speak for myself and I'm more interested in getting a job done. If that means my UI component uses class syntax, and my state and communications channels are functional reducers, so be it. I love JS because it's flexible and doesn't lock me into a paradigm. I can be as strict as I want to be. In the end, I think it depends on how someone thinks about problems. I tend to bend my thinking depending on the type of problem and how I might optimally solve said problem. When I need something else (often for performance), I'll circle around at that point for that part.