Live data from Hacker News

Reasons Python Sucks

hackerfactor.com

391–400 of 554 posts

Re: Reasons Python Sucks

#391

Earlier quoted context omitted.

In no particular order + Java doesn't promise "everything is an object." It has Base Types. + Python doesn't make a semantic promise that "everything is an object." Code for (3).fizzbuzz => "fizz" probably needs written in C because built-in types are closed and object literals use the built-in types. "3" cannot be forced to use a subclass of Integer. At the bottom, '3' is defined in terms of Types (i.e. "Built-in Ty…

probably needs written in C because built-in types are closed "Everything is an object" does not necessarily imply "all objects are always infinitely monkeypatchable at all times". It also doesn't necessarily imply "you can change how the parser interprets literals". You're also going to be really mad when you learn about __init_subclass__ and the fact that Python lets you write a class that can't be subclassed!

Python doesn't make me mad. It's frustrating because it's design never makes any sense to me.

__init_subclass__ is a perfect example. Not at the level of what __init_subclass__ does. But that instead of implementing private methods, there's are rules around double underscore methods and double underscore methods have different behavior (name mangling). They don't actually make the method private, the actual name is not the name in the source, and the name is not anonomized.

I can see a rationale for making some methods private. I can see a rationale for making no methods private. Python doesn't make methods private and then deliberately makes it hard to reap the benefits of this design decision. Instead of implementing the design intent of private methods, what gets implemented are impediments to utilizing the absence of private methods.

Re: Reasons Python Sucks

#392
post #265

Earlier quoted context omitted.

Isn't deep nesting (hence deep indentation) a sign of code smell? Yeah, you might end up shuffling the logic into a new file or a function that makes the file much longer, but I've noticed when doing that kind of refactoring it forces you to clean up the scoping quite a bit so there's less state to keep track of.

It depends on your definition of "deep". Imagine an if, inside of a foreach, inside of a function definition, inside of a class. This is not terrible code, it's perfectly reasonable. Now you're indented four levels in. Now combine this with some rather unreasonable and outdated assumptions that PEP8 (automatically enforced in many shops and OSS projects) has, like pretending that people are still on glass terminals a…

Four-space indent is very common in other languages too. I don't see why this choice should be argued over for Python specifically. The 80 char limit is also very common.

I too used to leave debug-code purposefully unindented. There are other ways to handle that and the loss is negligible to me considering there can't be misplaced braces in Python in return.

Re: Reasons Python Sucks

#393
post #118
post #116

Earlier quoted context omitted.

> I regularly wish python required some sort type indication for function parameters You can use type annotations, either via the builtin lib or 3rd party libs! https://docs.python.org/3/library/typing.html > do_x() if a.y() I feel this. You can use `a.y() and do_x()`, but I'm not sure how people would react :o

> You can use type annotations, either via the builtin lib or 3rd party libs! > https://docs.python.org/3/library/typing.html I know, but tragically, because I am not forced to, I never do. I do appreciate that feature though. Maybe this will be the impetus I need to start taking advantage of it.

You'll have a much better experience in an ecosystem where typing is the widespread expectation, IME.

Try an ML-family language if you haven't already - I find they combine the best parts of something like Python and something like Java. There was a post pushing F# earlier today.

Re: Reasons Python Sucks

#394

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…

I'm pretty sure Python's list type is implemented as a dynamic array, otherwise random access wouldn't work very well. Maybe try to not identify so hard with language choice? That way you gain the capability of processing critique without loosing your marbles.

Why should it matter how lists are implmented?

Re: Reasons Python Sucks

#395

My top 3 criticisms as an intermediate (~5 months of study) python programmer: 1. Importing behavior is ridiculous: https://chrisyeh96.github.io/2017/08/08/definitive-guide-pyt... 2. Python libraries' documentation leave a lot to be desired (compared to good javadocs). Just because your language is dynamically typed doesn't mean you don't need to describe what the expected shape of a parameter should be. 3. Static me…

> Private method/var? name it: __name (but it's not really private just hard to find)

This is why I _love_ python. Stop trying to protect me from your library. I've been doing some C# work and nothing bothers me more than having to fork and re-build an entire library just because the author didn't think I should be allowed to touch some variable that should've just been `public` or `protected`.

I don't need a library author to hard-block me from things. Put up the appropriate warning signs, then get out of my way.

Re: Reasons Python Sucks

#396
post #79

I'm quite surprised by some of these reasons: - 1 & 2: just use virtualenv, js has its own version manager too (nvm) which is very useful. This is one of the reason why only python2.7 is included in OSX, since most of seasoned python devs not use it. usr/include vs usr/local/include in cpp are not easier to use / understand. - 3: my opinion is this forces you to write readable code, in which you don't have to ask you…

> 3: my opinion is this forces you to write readable code, in which you don't have to ask yourself where the scope starts / ends

I agree with this so much. I've never looked at someone's python code and had a moment's confusion about where a particular function ends. On the flip side, I see plenty of randomly/confusingly indented C/C++/C# code.

Re: Reasons Python Sucks

#397

Earlier quoted context omitted.

What would you consider a beginner language then?

I don't think the term has much value. Maybe Scratch.

"Language for people who are not programmers but who need to instruct computers to do things" is the definition I work with. Scratch, BASIC, etc., aren't really suited to that role. No-one who's just trying to munge some files wants to be told "OK first learn this language that isn't useful for you, and then you can learn a language that is". Hence why practically, Python tends to fill the "beginner" role, which is unfortunate due to its complexity.

Re: Reasons Python Sucks

#398

My top 3 criticisms as an intermediate (~5 months of study) python programmer: 1. Importing behavior is ridiculous: https://chrisyeh96.github.io/2017/08/08/definitive-guide-pyt... 2. Python libraries' documentation leave a lot to be desired (compared to good javadocs). Just because your language is dynamically typed doesn't mean you don't need to describe what the expected shape of a parameter should be. 3. Static me…

As a former certified Java programmer, moving to Python was a breath of fresh air. More concise syntax, no more braces all over the place, much less boilerplate (think getter, setter, public static void main(String[] args)) and not everything has to be an object. First-class functions, yay ! (I haven’t used Java seriously since 1.6 so I don’t know how much the language has evolved since then). The only reason I’ve ha…

Coming from Java I loved Python's conciseness and convention, but as my codebase got larger I hit a maintainability wall where it was impossible to refactor reliably enough to keep the code clean and framework upgrades were always a massive task. Then I discovered Scala which combines the conciseness of Python (and allows you to write in a very "plain English" style if you want to, with the optional no-brackets call syntax) with the safety (and runtime and library availability) of Java.

Re: Reasons Python Sucks

#399

I'm a python hater. Yes it is easy, but in exactly the wrong way. Easy for simple code for middle schoolers. For grownups with large codebases to develop and maintain, it's not optimal. Of course I hate the whitespace trickery. I hate the auto formatting that sometimes doesn't work. Those are fairly minor. What I really, really hate is the lack of static typechecking. You often have to read lengthy swathes of code to…

While it is technically feasible to write a maintainable and well-organized large codebase in Python, in practice the lack of static types leads to a giant mess. After trying to maintain a legacy system written in Python (where all the authors had left the company) for a year, I threw my hands up and moved on to a Scala shop. I vowed to never work again on any major project written in a language without static typing…

> Look - if it works there, it's only because you have net fewer bugs to catch and lines to read, so the cognitive overhead can be born. But why not dispense with that cognitive overhead in the first place and just use static types!

I'm not convinced. When a program really is small enough to hold the whole thing in your head, writing that knowledge down is just overhead. (Of course, this reverses as soon as the program gets bigger than that).

Re: Reasons Python Sucks

#400
People hate on spacing, but people rarely talk about the benefits that specific spacing has.

Yeah, sure, you can complain about how strict it might be, and complain about how it can cause bugs when something is mis-indented.

But it's not like brace-languages are perfect either.

How about people who mix tabs & spaces within a single line because of lack of discipline or maybe a mistake from refactoring code? Imagine that nightmare of rereading that based on what editor you use.

Missing braces can sometimes be annoying and difficult to find, and placing the brace in the wrong place can result in bad code. Isn't that equivalent to a lingering whitespace in Python?

Yeah sure, you might say "Once you code enough, that usually doesn't happen" But Pythonistas can say the same thing with their indentation.

It's just a different way of programming. Get over it.

Post reply on HN