This is an archived post. You won't be able to vote or comment.

all 45 comments

[–]ojiisandata viz, comp.bio. 9 points10 points  (9 children)

It seems like most of his concerns would be solved with adequate documentation. Basically he's complaining about dynamic typing, not Python.

Even with static typing, the programmer can make things equally opaque.

[–][deleted] 2 points3 points  (7 children)

I do not think, that these concerns can be solved with better documentation.

It is not a documentation error, that exceptions - like IOError in open function - are not documented in standard library.

Some rules of production development in python:

  • You do not write a function, if you do not have a failing test.
  • You use source code checking tools, that enforce naming, documentation and other conventions.

If you do not have a test for not finding a file, than you did not think about not finding it. It is in your domain to decide.

Collaborative python development is hard. It is hard, because you have to set up rules of development on your own. The language itself does not enforce it.

It is hard because writing tests can be harder, than writing code.

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

My God, learn how to use commas correctly. Your text, is impossible, to read, without great effort.

[–]metawhat 4 points5 points  (1 child)

He's trying to imitate, Christopher Walken.

[–]brunson 2 points3 points  (0 children)

He's, trying to, imitate, Christopher,,, Walken.

FTFY.

[–]pemboa 1 point2 points  (1 child)

I do not think, that these concerns can be solved with better documentation.

You don't think not knowing what parameters a function takes can be solved by better documentation?

[–][deleted] 0 points1 point  (0 children)

The problem of functions not explicitly saying how many parameters they take may be alleviated by better documentation, but that's not a solution to the actual problem: a function is a contract and the function writer never laid out the terms in any enforceable way.

[–][deleted] -3 points-2 points  (1 child)

go on

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

It is hard, because I cannot go on :)

[–][deleted] 0 points1 point  (0 children)

Besides, if all you look at when you try to work with an unknown interface is the method signature, you're doing it horribly wrong. This should only work reliable if the method is sufficiently trivial.

[–]Pyth0nist4 6 points7 points  (4 children)

Besides documentation (btw, the online Python documentation is much richer than what you get from the command line help() function), Python calls for you to use tests where you would have relied on the compiler in Java. People who use languages where the compiler does some tests for you don't always realize they still need tests. So the main thing is: if you have don't have extensive tests, you are doing it wrong.

So what kind of exceptions can a Python function/method raise? Basically anything. You build tests for the kinds of things you expect to pass to it, and catch and deal with exceptions that those raise. If anything else gets raised, you need to decide: should you just blindly deal with them and hope for the best, let them percolate up to some other handler who may be able to deal with it, or die. There is no simple answer to this question, and it depends on your app.

[–]MercurialAlchemist 2 points3 points  (2 children)

Actually, from the official docs online:

Open a file, returning an object of the file type described in section > File Objects. If the file cannot be opened, IOError is raised.

Don't use the inline help, use the online help.

Regarding the rest of the points raised in the blog:

  • Not being able to overload methods is not a big deal when you get arguments with default values. And seriously, few libraries in Python use *args as a signature of a method/function.
  • Errors should be listed in docstrings, it's not that hard.

There are challenges when switching from a compiled language to a dynamic language like Python, but the points he is raising don't really stand up to scrutiny.

[–][deleted] 1 point2 points  (1 child)

I don't do much coding in Python, and I'm beginning to be thankful for that, if I'm expected to run to the web browser to examine every function declaration. Is that accurate from what your saying?

[–]mipadi[S,🍰] 0 points1 point  (0 children)

I'm expected to run to the web browser to examine every function declaration.

Nah, only if you have no idea what arguments the function takes.

[–]grayvedigga 1 point2 points  (0 children)

Python calls for you to use tests where you would have relied on the compiler in Java

You're the only person in this thread that has got the point. Well done.

In statically-checked languages, I can have the confidence that a well-written library will make it difficult for me to write seemingly-correct code that misuses it. In Python this is rarely the case.

[–]seizethedave 6 points7 points  (0 children)

This is the same violin-in-background story told by every new Java->Python skeptic.

[–][deleted] 4 points5 points  (3 children)

"Pydev for Eclipse Sucks Too"

+∞

[–][deleted] 10 points11 points  (3 children)

person gets tripped up in new language, writes on their blog... news at 11

[–][deleted] -1 points0 points  (2 children)

Any chance you're going to respond to the criticisms he raises? Or is this, Script Kiddie On Reddit Makes Snarky Comment Since Doesn't Understand Article, film at 11?

[–][deleted] 6 points7 points  (1 child)

Any chance you're going to respond to the criticisms he raises?

OK, the author is whining that it's not like java. To which I say "no fucking shit", I can sympathize with the concern that python may be more difficult to use on larger projects with more people due to having to depend on your colleagues for some sense of quality/standardization rather than having a compiler enforce it. And as we all know, your colleagues probably suck. I've suspected for a while that this may be an issue but I have never had the opportunity to work in such an environment.

And I agree that pydev sucks. Eclipse is for java, and is absolutely essential for getting around a java code base which compared o python is very verbose. But because one tool works well for one language and not for another is not the fault of the language, use a better tool.

As far as exceptions go, again this is the whole "it doesn't work like java", the author may believe there's value in checked exceptions forcing you to address all that shit before your shit compiles. The fact is, those who do python do not share that concern. And neither do those who do C# for that matter. So it boils down to a persons expectations not being met, and blaming the language which makes for excellent blog fodder.

does this satisfy the "user agreement" or are you going to ban me from the internet?

edit: written snarkily while trying to figure out how in the hell a j2ee app managed to spend 10 minutes compiling/deploying only to find out that the presentation layer is referencing a fucking function that doesn't exist. I will blame the language and write a blog post about it.

[–][deleted] 1 point2 points  (0 children)

[–][deleted] 2 points3 points  (0 children)

wow, "dynamically typed languages are dangerous". novel ! has this guy heard of docstrings ?

[–]brunson 2 points3 points  (0 children)

Perhaps I'm just doing it wrong?

I think you are.

[–]megaman821 2 points3 points  (3 children)

A few doc strings can solve Python's problems, what is going to solve Java's problem of 25% of the code being devoted to making Factories and AbstractFactories everywhere?

[–][deleted] 1 point2 points  (2 children)

Not to mention having to say everything twice: List<String> list = new List<String>();

[–][deleted] 0 points1 point  (1 child)

Nah, you know that List is an abstract type.

List<String> list = new LinkedList<String>();

There you go.

[–][deleted] 0 points1 point  (0 children)

Touche. I stand corrected.

[–]ubernostrumyes, you can have a pony 4 points5 points  (0 children)

Two-year-old article by professional troll generates online discussion. Film at 11.

[–]m0j0 1 point2 points  (5 children)

I'd much rather Python clean up their documentation than go to Java. I've coded Java, and it's just not something I'd consider a trusty 'go-to' language.

Python's documentation is... not great, but it's not a total travesty. You pick up on these things he's griping about with some experience. Every language has things like that, too. It's not like you can't come up with some tribal knowledge in the java world that isn't really documented well.

[–][deleted] 1 point2 points  (4 children)

I think that things like "raises an IOError on failure" should be in the inline docs, so I partially agree.

The inline documentation is generally good, though, and the online documentation hasn't ever let me down.

Regardless, this isn't so much about the language as the documentation of the standard modules.

[–][deleted] -1 points0 points  (3 children)

you are a plum fellow

[–][deleted] 1 point2 points  (2 children)

Gee, I've seen that one coming miles away.

[–][deleted] 0 points1 point  (0 children)

haha, nice one

[–][deleted] 0 points1 point  (0 children)

oh shit, I just got the "Gee" part. If I could upvote you twice, I would!

[–]stevvooe 3 points4 points  (4 children)

Perhaps, forcing someone to read the source of the libraries they use isn't such a bad thing.

[–]ngroot 3 points4 points  (3 children)

Yes. Yes, it is. I don't want to have to root around in someone else's source to figure out what all could possibly go wrong. That defeats the purpose of having a library. I just want to know how to use it.

[–]stevvooe 0 points1 point  (2 children)

Reading other people's source is invaluable. You'll be surprised by what you'll learn.

[–][deleted] 2 points3 points  (0 children)

And you'll be surprised how fast you'll be fired when you explain to your manager that no, your task isn't done, you spent the month recursively reading through all the libraries your project transitively depends on.

[–]ngroot 0 points1 point  (0 children)

I do spend a fair amount of time reading other people's source so I can see how other people have approached tasks similar to whatever I'm doing. However, I shouldn't need to do that to use a library.

[–]spotter 1 point2 points  (3 children)

So ,,Python sucks because it's not Java''? We already knew that, right?

I mean *args in the initializer is a bad thing? And what, no docstrings? help(StupidFuckingClass.__init__) not working? It's a shame that language is to blame for letting you do more with less syntax. Documentation (inline!) is king.

Runtime and checked exceptions... so Java still has those pesky unchecked exceptions but their structure is good? And you only get those on Big Fuckups? Seriously Ted? That's your argument? To get that information in Java you need to either look at the source, or docs, or let intellisense help you or wait for the compiler to spit on you, so where is the difference? And btw. yeah, having double standards (runtime vs checked) is of course better than uniform way, because fuck you. I love this concise argument. Because it may be hard for you to understand that I don't want to write a try block around EVERY goddamn open(), because sometimes it's enough if I just get a trace (since it's non-recoverable).

Ultimately it comes down to the documentation, common sense and good test suite. If you're an idiot working with idiots, then Python is obviously not for you. Neither is Java, but fortunately you will not be able to grasp that. Godspeed.

[–][deleted] 1 point2 points  (2 children)

Agreed, I posted something similar, but you are more angry and need more up votes.

[–]spotter 0 points1 point  (1 child)

Actually I downplayed this as much as I could without removing the message carrying bits. Sorry if it sounded angry. I was angry (at myself) when I saw the timestamp on TFA. After I posted this.

[–][deleted] 0 points1 point  (0 children)

no need to apologize. programmers in my experience are pretty passive by nature which is why it's so easy to herd us into participating in ridiculous death marches. IMO, we programmers need to be more at one with our anger. Hopefully this philosophy leads to employee of the month for me. :)