Live data from Hacker News

Reasons Python Sucks

hackerfactor.com

171–180 of 554 posts

Re: Reasons Python Sucks

#171

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…

Glad you took the time to write that. I stopped reading the article after his beef with imports...

Re: Reasons Python Sucks

#172

the self argument for methods/method calls is stressful (having to define self for methods and having to call a method via self); also the fact that you need to check if dictionary key exists, else you get an exception when trying to get the keys value. Also ':' at the end of each line. I always forget at least one of these. You didn't have any of these goodies in good old perl (sob, sob) (wow, this one got flagged p…

You don't have to define 'self' in Perl code, but you should. You don't have to check if a key in a dict exists, but you should. Not doing these things, and the crappy code that results, are part of why people make fun of Perl.

  $ cat > foo.pl {"hash"} = { "thng1" => shift };
        my $key = $self->{"hash"}->{"thing1"};
        $self->increment($key);
    }
    sub increment { $_[1] + 1 }
  }
  my $count = Foo->new()->method(33);
  print "count: $count\n";
  EOF

  $ perl foo.pl && echo "Program succeeded"
  Use of uninitialized value $_[1] in addition (+) at foo.pl line 12.
  count: 1
  Program succeeded
The debugger is telling us about an uninitialized variable in Foo::increment(), but the bug is really a missing dict key in Foo::method() due to a typo. We never checked if it existed, Perl didn't care either way, and the program didn't even fail. In code that's more than a page long, good luck spotting that...

Re: Reasons Python Sucks

#173
I thought I was the only one to put debug code in the first column. (The code doesn't last long; generally debug code in the first column is expected to be removed very soon; debug code that lasts longer goes in its proper column.)

Re: Reasons Python Sucks

#176

Earlier quoted context omitted.

It is usually the "first language" of choice these days, when teaching programming.

That does not mean beginner-friendliness is one of its design goals.

It was though

https://www.artima.com/intv/pyscale.html

"So I never intended Python to be the primary language for programmers, although it has become the primary language for many Python users. It was intended to be a second language for people who were already experienced programmers, as some of the early design choices reflect. On the other hand, intuitively I probably stuck to many of ABC's design principles. Because although I had my criticisms of ABC, I borrowed many of its valuable elements, which eventually made Python a great language for people who aren't ace programmers or who are just learning. We now have a large community of people using Python as an educational language, teaching Python in schools. These people aren't and may never be professional programmers, but they still find some programming skills useful." -GvR

Re: Reasons Python Sucks

#177
post #114

Earlier quoted context omitted.

> And I pity anyone who miscounts spaces and accidentally puts in three spaces instead of four somewhere -- this can take hours to debug and track down. this is so hilariously wrong that it is clear that the author has never actually tried any of the things he complains about. Python 3.7.1 (default, Oct 22 2018, 10:41:28) [GCC 8.2.1 20180831] on linux Type "help", "copyright", "credits" or "license" for more informat…

Not to mention, who hits the spacebar four times for their indentation? Actually. Do people do that?

I frequently have to when copy/pasting code in VS Code and it assumes the wrong indentation level.

Re: Reasons Python Sucks

#178

Earlier quoted context omitted.

What Java, JavaScript and C# call "arrays" are each very much like what Python calls "lists'. In particular the indexing after push() and pop() type operations and the bigO of indexing. More abstractly, Historically, in computing "list" connotes pointers and "array" connotes sequential memory. The connotations imply engineering tradeoffs. [1] "List" may make more sense for a beginning programmer. It is an arbitrary c…

What Java, JavaScript and C# call "arrays" are each very much like what Python calls "lists'. In Java and C#, 'arrays' are fixed size at creation time. Both Java and C# provide 'lists' which are variable sized* Python 'lists' are variable-sized. Seems like a consistent naming scheme to me? *there might be an underlying array that gets reallocated - but it's encapsulated within the list object; the reference to the li…

Fair point, technically.

But Python predates C# and Java.

Re: Reasons Python Sucks

#179

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…

> And I pity anyone who miscounts spaces and accidentally puts in three spaces instead of four somewhere -- this can take hours to debug and track down. this is so hilariously wrong that it is clear that the author has never actually tried any of the things he complains about. Python 3.7.1 (default, Oct 22 2018, 10:41:28) [GCC 8.2.1 20180831] on linux Type "help", "copyright", "credits" or "license" for more informat…

I think the problem he is describing--somewhat poorly--is when the "third space" just happens to match some other scope above, and therefore is syntactically valid, but not nested the way one initially thought.

Those kinds of problems can be hard to track down.

Re: Reasons Python Sucks

#180

A better reason to hate Python: the internal model is way overcomplicated for what it's meant to be: a beginner-friendly scripting language. "Everything-is-an-object", duck typing, decorators, bizarre scoping rules, etc., all make it difficult for experienced programmers to understand, let along beginners. I've always thought there's a much simpler language struggling to get out of Python, and I wish it would and wou…

> I've always thought there's a much simpler language struggling to get out of Python

I agree, although I suspect we have different ideas as to which parts of Python would be included in that simpler language. For example, I quite like the consistency of "everything-is-an-object".

FWIW some of the Python core developers have started to express a similar sentiment. Especially in the last few versions, where Python has got much more complex with the addition of type annotations and multiple `async/await` features. I wonder whether the retirement of the BDFL will slow down Python's rate of growth, or accelerate it?

> nested generator comprehensions behave differently than nested list conprehensions

I haven't come across this - could you give an example?

Post reply on HN