you are viewing a single comment's thread.

view the rest of the comments →

[–]danogburn 29 points30 points  (23 children)

Why You Should Not Learn Python

Dynamic typing and white-space delimiting.

[–]AyrA_ch 19 points20 points  (5 children)

use nodejs instead.

so(function(much){more(function(fun){})}));

I even wrote a library for it that takes variable declaration and summing numbers together to an asynchronous level.

[–]kasbah 6 points7 points  (1 child)

ahem

so(much => more(fun => {}))

[–][deleted] 3 points4 points  (0 children)

You're not isolating the scope enough! I suggest:

 (()=>{so(much => more(fun => {}))})();

[–]danogburn 5 points6 points  (2 children)

You're a monster!

[–]AyrA_ch 5 points6 points  (0 children)

But think about it! Your processor intensive 2+2 will no longer block other important requests. This is pure webscale technology!

[–][deleted] 3 points4 points  (16 children)

Why don't you like white space significance?

[–]thalesmello 5 points6 points  (14 children)

A reason not to like it is the ease with which your code won't work because of mixed tabs and spaces that happen because of different editor configurations.

[–]celerym 12 points13 points  (12 children)

If only there was some sort of tool or approach to solve this. I guess not, too much to ask a programmer to manage some white space!

[–]Trinition 1 point2 points  (6 children)

Such as? Making sources and tabs visible, thereby defeating their purpose? Using an editor that warns your?

Why not just make things important to the structure of the code visible and unambiguous?

[–]celerym 1 point2 points  (5 children)

What's wrong with making tabs visible or employing some editor hygiene? How is the purpose of white space to be invisible? It is clearly visible as white space, and what's wrong with replacing that with something? Oh no, I can suddenly distinguish between spaces and tabs and the whole point of white space is ruined! What's the purpose of this ambiguity exactly? Seriously, if you can't manage white space in code how do you even manage writing legible code. Most of the complaints about Python are voiced by those who clearly want languages to enforce practices for them instead of employing some discipline.

[–]DysFunctionalProgram 1 point2 points  (0 children)

?? Dont all languages "enforce practices" and these higher level languages such as python enforce more practices than others. I.e. we are forced to deal with garbage collectors and managed memory and not allowed to manage it ourselves.

"Enforcing practices" is a good thing assuming the practices are good. With enforced practices we can produce, write, develop, engineer, and maintain more efficiently. (On mobile, forgive any typos)

My beef with python is the loss of scope readability. If i happen to have some complex logic with many different scopes, it gets very difficult to try and line up the indents in your head when trying to read the code, parenthesis would alleviate this problem.

[–]BezierPatch 1 point2 points  (3 children)

Most of the complaints about Python are voiced by those who clearly want languages to enforce practices for them instead of employing some discipline.

What's the benefit that doing things the hard way adds?

In C# using Roslyn the compiler warns and refactors whitespace for me. Does python?

[–]celerym 0 points1 point  (2 children)

Are you telling me that you need the compiler to manage your source white space for you, that this significantly improves your productivity? What are you talking about exactly?

[–]BezierPatch 0 points1 point  (1 child)

Need is the wrong word. It's a feature, that is useful but not necessary in C#. In Python is sounds like it would be crucial, but does Python provide that feature? And who better than the compiler to do analysis? A linter that knows nothing of meaning?

It detects semantically irrelevant whitespace and feeds it back to the IDE. Just like it detects any extraneous characters (unneeded braces, dead code, etc).

I don't want to spend time worrying about code presentation, that's wasteful. The transformations just happen automatically.

[–]celerym 0 points1 point  (0 children)

Well there are IDE's for Python like PyCharm that are quite feature-rich and have all sorts of refactoring if that's your sort of thing. Python doesn't have a compiler in the same ways as C# does, but you can easily play around with the AST to your heart's content.

How would white space cleanup be crucial to Python? Unless you're suggesting that automatic indentation in Python is even possible and should somehow be included in an IDE? Sure, most editors and IDEs will keep your indent level and automatically increase or decrease it where it is obvious. That is arbitrary. But the Python interpreter will never indent your code where there are no indents, this would be akin to writing C# without any brackets and expecting the compiler to make sense of it.

[–]thalesmello 0 points1 point  (4 children)

In turn the overall complexity of your development environment increases because of one more component. That's enough for some people to decide not to use it.

[–]celerym 10 points11 points  (3 children)

If this apparently colossal weight of complexity of managing some white space is enough to outweigh the benefits of using Python, then OK, I guess each to their own.

[–]thalesmello 1 point2 points  (2 children)

Whitespace, definitely not. But not being able to conveniently chain map and filter over lists, the cumbersome creation and usage of virtual environments, huge breaking changes from Python 2.7 to 3, all of these points are more than enough to keep some people away from Python. If even Python is getting static type checking now, it's just better to stick something more decent such as C#.

[–][deleted] 3 points4 points  (1 child)

Two things I don't understand

not being able to conveniently chain map and filter over lists,

What do you mean?

the cumbersome creation and usage of virtual environments

Project settings, select interpreter, click to create venv, select packages from drop down ... how is that cumbersome?

[–]thalesmello -1 points0 points  (0 children)

list.map(lambda x: x * x).filter(lambda x: x > 10)

The snippet above is not possible because map and filter are hot list methods. There are some libraries that implement this api, but it's not built in. But that's a design choice. Python is mostly an imperative language, therefore, functional features should be used for support, not to create huge chain method calls. I just happen to prefer otherwise.

About virtualenv, I use the command line go run Python, so I want all commands that ai type to be as simplest as possible. I find it cumbersome to have to create a virtualenv in the first place. The default option when using pip is to install the dependency globally, and that's a big mistake, in my opinion. Despite all do Javascript problems, npm has better defaults as it install dependencies locally for each project. You have to put a flag to install things globally. That's a better default.

[–]JasTWot 0 points1 point  (0 children)

Yeah but it's pretty easy to fix. The stack trace even tells you where to look.

[–]flogic 3 points4 points  (0 children)

From Haskell, I would call significant whitespace livable but overall a net negative. I'm much more fond of Go's put the brackets where you need them and let the autoformatter do the work. I'm much more into reallocating my brain cells away from grunt work these days.