Live data from Hacker News

I don't like Python. Does that make me a bad person?

news.ycombinator.com

51–60 of 231 posts

Re: I don't like Python. Does that make me a bad person?

#51
I'm a guy from a C/C++ background who did linux kernel development, and picked up python along the way and used it to do desktop tools. I used python (without knowing any of it) to write a disassembler for a project I was doing in 2003 on a non-x86 processor. It took me 5 days to learn the language enough to do so and to write the entire tool, at which point I "got it".

First off, Java isn't a toy language. You've characterized it improperly. Java is a bureaucratic language. You have to cross your t's dot your i's, fill out your requests in triplicate at the FactoryFactoryFactory to get the objectOfYourDesire. Why is this so?

This comes back to how C++ works on projects, especially large projects and midsize projects with a couple mediocre programmers thrown in (because, in commercial software development, you rarely get control of your team). C++ does not work well for large team development unless 1> You have very capable people 2> and you can fire everyone who steps outside the "defined okay subset" of C++ you use on the project. The language is too big, certain parts make it too uncertain, etc, for people to just willy nilly use all the language features. So Java, is basically Sun's "redoing" of C++ where they took its wild west nature, and made a BureauDisney version where you can't do a dozen things that happens in C++ all the time when good programmers go off the reservation or bad programmers enter the equation at all.

C++ has uses, but it's the sulfuric acid of programming languages: you have to have good personnel control and fire those who screw around outside the boundaries of the right style. A programming group with one guy programming like C with classes and another guy programming like it's Ocaml without garbage collection, and you're in for a mighty piece of hell.

So that's where Java came from. That's why it is what it is, and I hope I've highlighted a non-business issue with C++ that comes up from it's overabundance of "understanding breaking powers" which don't mess well with total programmer freedom.

Now lets look at what python was, and what it is now: Python was originally designed as a substitute for the pascal/BASIC line of programming languages (specifically a language called ABC). It was designed to be very very clear. It still is very very clear. It is still quite terse compared with C++/Java/C, but it's wordier than perl and ruby, but very much clearer for even non-python programmers to decipher much of the time.

Over time, it grew into an Application development and webserver development language. Why?

It has a very easy way to interface to C code. This is important, because C does great module level integration, but once you get at the system level, you start to get issues with namespaces, tracing bugs, etc. So python became an alternative for tying C code together.

It writes very quickly. While you may not understand how to write it quickly yet, usually python/ruby/perl will be quite a bit more productive on a feature basis than Java/C#, and tons more productive than an equivalent C/C++ project. This has to do with the fact it takes very few lines of these languages to "do a job".

For you currently, you're possibly less productive in python right now than you are in C++; I've honestly found this doesn't hold true more than 40-80 hours into learning python development while doing a real project for almost anyone who can handle commercial C++ software development. The C++ people do python faster than they do C++ and it has many fewer issues in the end than C++ they would have wrote. We use weave.inline or something else to speed up the inner loops with some native C, if even required for that application, and all is good, it works just as fast for the user or application, and was completed much faster with much less obtuse bugs.

If you spend those 40-80 hours on the language, you too will likely be a faster developer in python than C++ for many features.

Some tips: You are not doing C, you are not doing C++, you are not doing Java. Don't pretend you have to do the bueracracy that those languages require. If you write a python program with absolutely no functions, it will run just fine. So if all you need to do is process a small amount of text or open a little server, you can do this in a flat file with just a series of lines of code striaght out of main() in a C program. However with the size and completeness of the python standard library, you'll rarely have to write the rest of the functions.

Secondly, it's important to learn idomatic python today. If you write things like "it's supposed to be" in python today, you get speed on par with C/Java (or only 3-5x slower), and it's really freaky to see an interpreted language do that.

Thirdly, it's important to learn and use the standard language rather than writing code. Python module of the week blog is a great resource to do this: http://www.doughellmann.com/projects/PyMOTW/ Much of python's power comes from a stupidly complete standard library that does much of what you need to do so allows you to write 20 line programs.

Lastly, learn easy ways to fall back on C/C++ in python. This way when you use python for an application it turns out it's too slow for, you can still add a bit of C/C++ to get the speed you need. You can embed C++ inline and have it compiled on the fly with weave, so I suggest you learn that.

http://www.scipy.org/Weave for getting it

http://www.scipy.org/Cookbook/Weave for examples of use

http://www.scipy.org/PerformancePython for examples of how fast this runs vs other things.

Re: I don't like Python. Does that make me a bad person?

#52
post #15

Earlier quoted context omitted.

This is the main draw for me. Compared to Python, other languages (well, some) seem to require you to do so many things that just seem... unnecessary. I couldn't believe all the junk Java required of me when I took a stab at it. It's like being confronted with some unhelpful bureaucrat: I know what I mean, they know what I mean, but they're damn well going to make me trudge through all the nonsense so that what I mea…

Java is, as I said, a toy language. A language that needs you , the client programmer, to define getFoo () and setFoo () methods manually can't be right.

Java doesn't require you to define getFoo() and setFoo(). Some best practice advice suggests you do. But you can leave the vars public and just use the . operator, if you choose.

It seems like Java wasn't defined in order to be an efficient for a three-person shop to hack in. It was meant to be efficient for a 40 person shop to build code as a team that they can maintain.

That said, I dread going back to my Java projects and updating them, even though I tried to maintain best practices in order that updating be as simple as possible. I've been immersed in php and javascript lately, so we'll see what it's like to go back.

Re: I don't like Python. Does that make me a bad person?

#53
I started off hating Python as well. I could not stand a language that didn't terminate statements without semicolons! :) And python just seemed a lot like Perl; when using both languages for large projects my code just seemed to degenerate to "hacky."

But I've grown to like the simplicity of Python. One thing I don't like is its threads implementation, however. Because of the GIL, multithreading (GUI + background thread) just doesn't work right. Maybe I'm using it wrong?

Re: I don't like Python. Does that make me a bad person?

#54
post #51

I'm a guy from a C/C++ background who did linux kernel development, and picked up python along the way and used it to do desktop tools. I used python (without knowing any of it) to write a disassembler for a project I was doing in 2003 on a non-x86 processor. It took me 5 days to learn the language enough to do so and to write the entire tool, at which point I "got it". First off, Java isn't a toy language. You've ch…

[deleted]

Re: I don't like Python. Does that make me a bad person?

#56
post #44
post #6

Earlier quoted context omitted.

I've never understood this objection. Do you not indent your code anyway? If so, why should you also need to delineate scopes in another way? Python allows you to choose your indentation, it just requires consistency: something that is always required by coding standards (with good reason). If there was a command line switch, would you use it? Why?

I indent my Perl code. Not everyone does, however. It's a trivial task to reformat it in an editor. I guess the only complaint I might have is why bother thinking about indentation, ever? Throw in a couple of {} and now the tools can provide additional help.

The point is, I've never met a programmer who doesn't think of indentation. I've never seen a (real) project which doesn't have indentation. So if everyone is doing it anyway, why not take advantage of it and make it a part of the language? This way programmers learn to use indentation from the start (which any real programmer uses anyway), and indentation is always correct, nothing to ever think about.

Re: I don't like Python. Does that make me a bad person?

#58
post #44
post #6

Earlier quoted context omitted.

I've never understood this objection. Do you not indent your code anyway? If so, why should you also need to delineate scopes in another way? Python allows you to choose your indentation, it just requires consistency: something that is always required by coding standards (with good reason). If there was a command line switch, would you use it? Why?

I indent my Perl code. Not everyone does, however. It's a trivial task to reformat it in an editor. I guess the only complaint I might have is why bother thinking about indentation, ever? Throw in a couple of {} and now the tools can provide additional help.

I indent my Perl code. Not everyone does, however. It's a trivial task to reformat it in an editor.

But in Python, you don't even have to worry about other people not indenting their code!

I guess the only complaint I might have is why bother thinking about indentation, ever? Throw in a couple of {} and now the tools can provide additional help.

When you edit Python, the tools can already help as much. The start of a block is obvious (def, if, for, etc), so tools indent for you. To dedent, just hit the right key (e.g. a backspace on an empty line in emacs) -- no harder than hitting the brace key.

Re: I don't like Python. Does that make me a bad person?

#59
post #4

Yesterday there was an interesting link on HN comparing NLP in Python vs. other languages: http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.ht... . I think this article shows the clearness of the Python language - - and this clearness and simplicity is the reason why I love to code in Python.

Python for me is the language closest to pseudocode. There are no decorations and few gimmicks. You simply write your ideas down into code.

On the contrary, it has had decorators since Python 2.4.

Re: I don't like Python. Does that make me a bad person?

#60
post #51

I'm a guy from a C/C++ background who did linux kernel development, and picked up python along the way and used it to do desktop tools. I used python (without knowing any of it) to write a disassembler for a project I was doing in 2003 on a non-x86 processor. It took me 5 days to learn the language enough to do so and to write the entire tool, at which point I "got it". First off, Java isn't a toy language. You've ch…

You are not doing C, you are not doing C++, you are not doing Java.

This is the best tip that could be given. In the SICP course in Berkeley CS class, the instructor puts it as

"Don't ask me what the language will do if you do something stupid, the answer will always be either you would get an error or the computer will do something stupid. Don't try to convert java code into LISP, try to think in the language."

Post reply on HN