Live data from Hacker News

Reasons Python Sucks

hackerfactor.com

121–130 of 554 posts

Re: Reasons Python Sucks

#121

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…

Seeing your invitation for critique..

I didn't downvote you, but you present complaints without support or putting forward alternatives other than everyone should ditch Python in favor of Perl. 2 of your 3 complaints come across as shallow syntactic bikeshedding presented without support.

It would be interesting to read your take on the engineering problems involved, the design tradeoffs involved, and why you think Perl's decisions are more appropriate than Python's decisions, even for Python's main use cases.

Python rubbed me the wrong way when I first encountered it, then I really loved it for a few years. Now, I feel it's pretty good at what it does, but I find other languages more interesting.

Maybe you have some good reasoning behind your gripes, but you don't provide any evidence that you've thought much about them or put any effort into understanding the design decisions.

For your first complaint, I do agree that the explicit self parameter vs just making it a keyword is hard to justify in retrospect, but is it really raising your blood pressure, causing you to lose sleep, etc? Your use of hyperbole doesn't help your case.

I presume that making all method calls explicit is to keep scoping sane in the case where a subclass defines a method that happens to accidentally conflict with the name of a function called in some superclass's method. An alternative would be to use static name resolution to resolve the ambiguity, but then you'd have to be statically invoking metaclasses to figure out which methods were in scope, or you'd have to get rid of metaclasses and generally get rid of a bunch of the effort Python goes through to be very late-binding and generally dynamic in behavior.

For your second complaint, if you don't want the dict to throw, use the get method instead of the brackets operator.

For your third complaint, I'm not sure exactly what you're complaining about. Clearly not every line literally ends with a colon, and you're again making poor use of hyperbole. Guido has commented in at least one interview that most of the colon's aren't necessary to disambiguate the grammar, but they really do help beginners in particular read the code.

Showing more effort toward educating and/or convincing people would help avoid the downvotes.

Re: Reasons Python Sucks

#122
For one and two: in what world is any of the software in repos like apt or yum up to date?

Every time I set up an ubuntu machine for using at work, I end up compiling a few packages from source, a myriad of packages that are installed from app images or curl | bash installed binaries (like docker, ugh), and more PPA's than I care to keep track of and clean out. And now there's flatpack, snapcraft... packaging on linux is a mess currently.

Honestly, on workstations the rolling release model is the only one that makes sense.

But for python, with tools like pyenv, virtualenv, or even just using LXC/docker/vagrant/whatever, versions in the 3.5-3.7 range are a non-issue.

I agree the quotes thing sucks, though. I wish there was more enforced discipline on that.

Re: Reasons Python Sucks

#123
post #100

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…

It's funny how far off the author was, because there are genuine things to complain about with python, though they may not be exclusive to python. I regularly wish python required some sort type indication for function parameters, because dealing with libraries that take complex objects as function parameters can be an absolute nightmare. I wish python had some equivalent to the switch statement that didn't involve w…

> I regularly find myself wanting to write something of the form do_x() if a.y() This is stupid, but I still kind of want it since do_x() if a.y() else do_y() is valid

cough maybe you should be programming in Ruby ;)

Re: Reasons Python Sucks

#124

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 think a simpler language would also have more potential for speedup. The effort PyPy has invested is herculean! Grumpy, Cython, Unladen Swallow, etc.

Python has fallen to my second or third most commonly used language now and speed is definitely a reason.

Re: Reasons Python Sucks

#125

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…

Thank you for going point by point. I was blown away by how little experience the author had with Python, compared to how strong his opinion is about it. I hate hate hate language debates, but this isn't even that, it's just a misunderstanding. If this guy took a class on Python he'd figure out like 5 or 6 of these issues no problem!

Totally agree. The author needs to read the Python docs.

Re: Reasons Python Sucks

#126

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 wouldn't have to recommend Python to beginners any more, and be on the hook for explaining e.g. why default values are mutable, or why nested generator comprehensions behave differently than nested list comprehensions."

Maybe those scoping gotchas are not beginner topics?

Re: Reasons Python Sucks

#127
As far as I can tell, nobody creates new code for PostgreSQL 9, but we drag it along because nobody's ported the needed code to PostgreSQL 11. At the official PostgreSQL web site, their documentation is actively maintained and available for PostgreSQL 9.4, 9.5, 9.6, 10.6, and 11.1 -- because they can't decide to give up on the old code. PostgreSQL is like the zombie of relational databases -- the dead just keep walking on.

Re: Reasons Python Sucks

#128

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 wouldn't have to recommend Python to beginners any more, and be on the hook for explaining e.g. why default values are mutable, or why nested generator comprehensions behave differently than nested list comprehensions." Maybe those scoping gotchas are not beginner topics?

> Maybe those scoping gotchas are not beginner topics?

They are the second one of your beginners trips over them. Especially the first one is fairly easy to encounter and really vexing.

That said, Python in my experience is an excellent beginner language, and I'd still recommend or teach it.

Re: Reasons Python Sucks

#129
> And Python? It uses spaces. If you need to define a scope for complex code, then you indent the next few lines. The scope ends when the indent ends.

Curiously, I never see the indent scope complaint about, say, Haskell. It's always just Python. I've wondered for a long time why that is. There's the obvious one, that Python is just far more popular, but I'd expect experienced people to have used or at least seen another language that does it.

Re: Reasons Python Sucks

#130
Author forgot to mention:

- The GIL (global interpreter lock), which can in some cases reduce your multicore CPU to a single core CPU.

- No multiline lambdas. You can't write a quick anonymous closure and pass it to another function, unless you manage to fit the whole thing in one line.

Post reply on HN