Live data from Hacker News

Reasons Python Sucks

hackerfactor.com

531–540 of 554 posts

Re: Reasons Python Sucks

#531
post #71

Earlier quoted context omitted.

Python (and Java) do not pass anything by reference. They pass by pointer-value. (If they passed by reference, you could change to which value a caller's variable was bound, like you can in C++).

Those languages use references rather than pointers (that is, their referring-things do not support arithmetic), so any name for what they do that involves "pointer" is a poor one. The distinction between passing the value of a reference being used by the caller and passing a reference to the caller's stack is so rarely important or useful that there's no consensus terminology for it. The distinction that's actually…

"Pass by value" and "pass by reference" are both wrong with respect to Python. They denote semantics that Python does not have, and coders believe and do wrong things if they believe Python follows one or the other. Hence a 3rd term is needed. I don't care what you call it, because it's just a name, but it is a distinct idea, and I'm not the only one who thinks this: https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sh...

> In Python, f can change the value of a

but it can't. `f` can't change the object which `a` references:

  def f(x): x = 5
is a function with no visible effect. When called as `f(a)`, `a` retains whatever value it had previously.

People who believe Python is "call-by-reference" don't understand this and write incorrect or overcomplicated code as a consequence. The distinction is important.

Re: Reasons Python Sucks

#532
post #427

Earlier quoted context omitted.

> and that's it, you're done You are seriously comparing Maven, a huge and over-complicated xml-based system that is not even installed by default and that people hate so much that there are umpteen alternatives (gradle etc), with `pip install -r requirements.txt` that works out of the box? I just can't even... > Python still doesn't have anything [like Maven] And I thank the Gods for that.

> with `pip install -r requirements.txt` that works out of the box? Works out of the box until you're missing a distro package that is required to build a dependency that needs to be compiled from source. I've never used maven so I don't know if it is better or worse, but I am not a fan of languages having their own package management system that has not integration with the distro one (which probably also offers som…

> I've never used maven so I don't know if it is better or worse, but I am not a fan of languages having their own package management system that has not integration with the distro one (which probably also offers some of the same packages, and mixing them breaks things in subtle, annoying ways).

Mixing is where Python (and Perl, even though it is integrated with the distro package management) go wrong, IME. Maven is isolated from the host package management but completely (or at least completely enough, in practice); most OSes don't bother trying to ship system-wide versions of Java libraries. The OS manages the JVM (and Maven), Maven manages whatever libraries an app wants on a per-app basis, and neither interferes with the other.

This does mean you get very little help managing dependencies of JVM libraries on native libraries; fortunately those are rare enough in the JVM ecosystem that you can handle the few that do occur by hand, IME.

Re: Reasons Python Sucks

#533
post #46

I agree with the OPs points but disagree with the degree to which the author has used them as a means to "hate" a language. I generally avoid Python too but saying you hate the language because of a bunch of contrivances mostly wrought from inexperience and holding too strongly to C like languages is poor form. Versions: Ok? Versioning and fragmentation is a hard problem. Backwards compatibility is a hard problem. Mo…

> Syntax: Yep. Spacing blows and you're always going to have stupid issues with it. I hate Python's spacing. Someone ought to create a custom interpreter that allows for using braces. Nope, for reasons I've explained up thread. In the meantime I suggest this code: from __future__ import braces

Your reasons amount to "use an editor that shows whitespace". That's valid and would be my suggestion to people too but it doesn't address my comment. Using an editor for a "necessary" feature only helps you when you have it. If you, on an off-chance, don't have it then you're going to have a bad time.

Comparing whitespace issues to brace-matching issues is a strawman. Braces are visible in 99% of editors.

Re: Reasons Python Sucks

#534
post #71

Earlier quoted context omitted.

Those languages use references rather than pointers (that is, their referring-things do not support arithmetic), so any name for what they do that involves "pointer" is a poor one. The distinction between passing the value of a reference being used by the caller and passing a reference to the caller's stack is so rarely important or useful that there's no consensus terminology for it. The distinction that's actually…

"Pass by value" and "pass by reference" are both wrong with respect to Python. They denote semantics that Python does not have , and coders believe and do wrong things if they believe Python follows one or the other. Hence a 3rd term is needed. I don't care what you call it, because it's just a name, but it is a distinct idea , and I'm not the only one who thinks this: https://en.wikipedia.org/wiki/Evaluation_strateg…

> They denote semantics that Python does not have

There is no consensus that "pass by reference" denotes that, whatever a wikipedia editor says. Normal working programmers do not understand "pass by reference" to mean specifically "pass a reference to the caller's stack" but only the more general concept of "pass a reference to the value of a". If you want to talk specifically about what kind of reference gets passed, you need some new terms for that, and both the new terms you come up with will be subtypes of what most of the world will continue to understand as a general category of "pass by reference". No-one outside of these arguments on HN gets confused about whether you can write a swap function in Python; people understand "pass by reference" to mean something more general and entirely true of Python (and Java and so on). You can tell by how often we see those languages described as "pass by reference".

> but it can't. `f` can't change the object which `a` references:

Yes it can. It can't make a to refer to a different object (as your f tries to), but it can change the object a refers to just fine.

Re: Reasons Python Sucks

#535

Most of the points in this article fall on a continuum between irrelevant to dead wrong. 1 (versions) and 2 (installation) have to do with the ecosystem, not the language. Unsigned packages are a real problem, but hating on community-maintained software is just weird. Most software in your local Linux distro's repository is maintained by a "community" that might just be one person working in their spare time. 3 (synt…

>>3 (syntax) seems to be about not supporting the author's own highly idiosyncratic habits, which include deep nesting and putting debug code in the first column (ugh). The result actually seems better for maintainability than the author's own unconstrained code would be.

Telling users they are not good enough for your technology is not the way you go about these things.

Also if this works in other languages, people do expect it should work in Python.

Re: Reasons Python Sucks

#536
post #183
post #119

Earlier quoted context omitted.

> 1 (versions) and 2 (installation) have to do with the ecosystem, not the language. This argument really summarizes a beautiful and dangerous thing we see in the tech community far too often; you have a strong technical and scientific understanding of the system, but lack product and design thinking. You're right. Its a problem with the ecosystem, not the language. I'm still not going to use python because of the ec…

Note how almost all languages you take as shiny examples of virtue post-date Python: they all learnt from it so much , particularly on things like the stdlib. Python’s stdlib was the gold standard for a long, long time (the “batteries included” slogan was effective for a reason - they really were!). This was not by accident - Guido and others have always had the utmost care for good developer experience out of the bo…

>>Not even Java, with all its commercial might, ever achieved that - it barely got a REPL last year, which Python has had for what, 20 years now?

Java has had Eclipse right from when users needed it for prime time.

And yes, Python's repl is barely a REPL. You are better of writing code and running it. Its not exactly Lisp experience.

Re: Reasons Python Sucks

#537
post #459

Earlier quoted context omitted.

> this is very obviously false, since a call need not involve any variables at all True, in which case the values would just be constants. But they will still get bound to names in the function's local namespace. > You are mistaken No, I left out a case which, it seemed to me, did not affect the main point I was making. If you want to make clear that that's a possible case, fine, you've done so. But you haven't refut…

> But you haven't refuted (or even engaged with) my main point at all. OK. Your main point (now that you have shifted the goalposts) seems to be that argument passing induces a binding of the parameter name to the argument value, yes? In the abstract, this point is meaningless since it applies equally to every other programming language. In this C function: void foo(int x, float y, char *z) { ... } the C compiler als…

> Your main point (now that you have shifted the goalposts) seems to be that argument passing induces a binding of the parameter name to the argument value, yes?

It's that there is an extra step involved that does not occur in languages like C.

> those bindings do not involve dictionaries as you seem to think

For positional arguments, you are correct. But, as you note, there is still an extra memory allocation on the heap, because the stack at the Python level uses heap memory, not stack memory, at the C level.

For keyword arguments, as you agree, there is a dictionary entry created.

> Local variables are exactly what you claimed they were not

More precisely, local variables inside a function that correspond to positional arguments are, for performance reasons, stored in an array of function local pointers at the C level, instead of being stored as dictionary entries (namespace bindings).

But the fact that this is a particular exception to Python's normal treatment of variables simply highlights the point I was making.

Re: Reasons Python Sucks

#538
post #533

Earlier quoted context omitted.

> Syntax: Yep. Spacing blows and you're always going to have stupid issues with it. I hate Python's spacing. Someone ought to create a custom interpreter that allows for using braces. Nope, for reasons I've explained up thread. In the meantime I suggest this code: from __future__ import braces

Your reasons amount to "use an editor that shows whitespace". That's valid and would be my suggestion to people too but it doesn't address my comment. Using an editor for a "necessary" feature only helps you when you have it. If you, on an off-chance, don't have it then you're going to have a bad time. Comparing whitespace issues to brace-matching issues is a strawman. Braces are visible in 99% of editors.

I use nano or micro at times, which don’t, problem doesn’t happen there either.

The benefits are enjoyed every single read of the code while the drawback is a potential issue (being very generous when I say) once every six months. Honestly happens about once every five years to me.

Re: Reasons Python Sucks

#539
post #427

Earlier quoted context omitted.

> and that's it, you're done You are seriously comparing Maven, a huge and over-complicated xml-based system that is not even installed by default and that people hate so much that there are umpteen alternatives (gradle etc), with `pip install -r requirements.txt` that works out of the box? I just can't even... > Python still doesn't have anything [like Maven] And I thank the Gods for that.

I do not see your comment as fair to the parent: > there are umpteen alternatives (gradle etc) there was ant (build tool) then came maven which is much more flexible and contains dependency management capabilities (and _is loved_ by many) nothing to add that the parent did not already say. Then came gradle which has faster build speed and features like incremental builds and a Groovy based configuration. pip did not…

> Then came gradle which has faster build speed and features like incremental builds and a Groovy based configuration

You make it sound like adding Apache Groovy for configuration to a build system is an improvement. When build systems with a declarative config language, such as make, ant, and maven, replace procedural build scripts, that's the improvement. Using a procedural language like Groovy instead is a large leap backwards because it encourages programmers to add unneeded procedural features to build scripts, creating an unmaintainable mess.

Re: Reasons Python Sucks

#540

Earlier quoted context omitted.

> The article read more like a rant of "I PERSONALLY HATE THIS" Given the entire premise of the post is that he's written a list of things he hates about Python as an answer to his friend's question as to why he hates Python, I'm not sure why you think there's some ambiguity here.

I think the issue is that the article is called "Reasons Python Sucks" rather than "Things I Hate About Python". It comes off as the author saying that these things are objectively bad about python even though many of them are clearly subjective.

Exactly this. The overwhelming majority of his arguments were purely subjective, like his points on code clarity or mandatory indentation.
Post reply on HN