Live data from Hacker News

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

news.ycombinator.com

61–70 of 231 posts

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

#61

I hate Python too, only because of its insistence on indentation and because of its verboseness relative to, say, Perl. I'm not against the non-Perl philosophy of There Is Only One Way To Do It, but for God's sake, don't insist on indentation! I am under a personal vow that until Python lifts its indentation requirement (say, via a command-line switch), I'm no way using this language for my programming needs.

The indentation is not a big deal at all. You indent your code anyway, right? Python doesn't enforce a specific standard, you can indent however you want, just as long as you use the same units of indentation consistently. The only time I've had a problem with indentation is while copy-pasting things, occasionally that can get messed up and be annoying. Everything else is fine.

The main reason I like having explicit braces and non-significant whitespace is that it allows me to use my whitespace flexibly to clarify the structure of a program.

There are some interesting ideas regarding the use of whitespace in C here:

http://www.quinapalus.com/coding.html

I don't agree with everything he has to say- for example, I think his nested for loop example would be far nicer as something like this:

  for(i=0;i
(Not to mention more in keeping with the principle of "alignment".) Still, if nonstandard indentation can make it easier to see the patterns in your code, it benefits both development and maintenance.

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

#62
post #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 th…

The Right Way for a long time was to run multiple processes. If you absolutely needed threads, then the Other Way That Is Less Correct involved launching threads written in C from a C extension

The Python community seems to be warming to the importance of threads. There are several efforts breaking their swords against the GIL nowadays (Unladen Swallow being the most prominent), and Antoine Pitrou wrote a new GIL to help improve contention [1]. With any luck, by the end of the Python Feature Freeze, there will be some significant headway towards efficient handling of threads within Python, but I'm not holding my breath yet ;)

[1] http://www.dabeaz.com/python/NewGIL.pdf

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

#63

Earlier quoted context omitted.

The indentation is not a big deal at all. You indent your code anyway, right? Python doesn't enforce a specific standard, you can indent however you want, just as long as you use the same units of indentation consistently. The only time I've had a problem with indentation is while copy-pasting things, occasionally that can get messed up and be annoying. Everything else is fine.

The main reason I like having explicit braces and non-significant whitespace is that it allows me to use my whitespace flexibly to clarify the structure of a program. There are some interesting ideas regarding the use of whitespace in C here: http://www.quinapalus.com/coding.html I don't agree with everything he has to say- for example, I think his nested for loop example would be far nicer as something like this: fo…

Would it not be better this way:

for (i = 0; i

     printf ("%d %d %d\n", i / 100, (i % 100) / 10, i % 10);
IMHO, such patterns (multiple nesting with empty outer loops), in most cases, are really an indication of just one real loop. Using multiple counters might also be an option.

In case the loops are doing something different, they should be indented separately. For instance, the following makes little sense:

for (i = 0; i foo (i);

for (j = 0; j

     foo (i + j);
for (k = 0; k foo (i + j + k);

}

}

}

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

#64
post #48

Earlier quoted context omitted.

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.

c++ feels incredibly bureaucrat to me too though. like separating definition from declaration into header files. what do you think of ooc-lang syntax? http://ooc-lang.org/

I think the header-file and source-file distinction was more of an architectural decision (so that you could implement an efficient compiling and linking system) than a language design decision.

Just an opinion, though.

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

#65
post #52

Earlier quoted context omitted.

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 proj…

Java certainly was not designed to be this "enterprise language" it is now. It only was similar enough to Smalltalk to replace it. (and Smalltalk has this culture of "if it is repetitive then extend IDE to automate it", which to some extent influenced Java IDEs)

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

#66
post #50

Earlier quoted context omitted.

I do indent my code, but I prefer to auto-indent. Using indentation to determine if a line of code falls inside or outside some logic block requires a lot more effort for me. Would much rather just use curly braces. Curly braces also make copying and pasting code blocks much easier.

I use auto indent on python all day. Not having to perform secondary bracket mark up is great.

You don't, because auto indent for python doesn't and can't exist.

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

#67
post #45

Earlier quoted context omitted.

You sound that you will like Haskell. It's type system can be really paranoid (it lets you express many invariants through it), yet remain very flexible. And If you can't fathom the segregation of (side) effects, there's still Ocaml.

OCaml is a dying, soon obsolete, language. Better use F# which has way better libraries and tools.

As I understand it OCaml is in heavy use at a number of shops in the financial industry. I wouldn't say it was dying just yet. On the other hand F# is a new and as compared to OCaml untried and untested language.

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

#68
post #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]

I hate to get all meta, but as of this writing the parent comment has -2 points. I understand that comments that just say "Interesting :)" are frowned upon on HN because they add no information. However, in this case the commenter is the OP. He's expressing thanks for a lengthy, informative response.

"Thanks for responding, that's an interesting perspective" is not a class of comment that deserves downvotes. It's completely appropriate.

(Update: The comment was deleted as I wrote this.)

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

#69
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.

I don't get what you mean by "toy language." Clearly some big, powerful, practical stuff has been written in it. Usually the phrase "toy language" is used to refer to those with little practical use. Java is unwieldy, but it has a rich ecosystem and compiles to very efficient code across a broad range of platforms.

If you want Java without the unwieldiness, try Groovy. It's Java with a ton of syntactic goodness added; for instance, the default variable scope is "create a getter and setter which I can optionally override." Groovy interoperates well with Java libraries. The downside is that it's a dynamic language, so there is a significant performance penalty.

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

#70
post #6

I hate Python too, only because of its insistence on indentation and because of its verboseness relative to, say, Perl. I'm not against the non-Perl philosophy of There Is Only One Way To Do It, but for God's sake, don't insist on indentation! I am under a personal vow that until Python lifts its indentation requirement (say, via a command-line switch), I'm no way using this language for my programming needs.

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?

Python's whitespace indentation seems like a great idea until you realize that it makes things like copying & pasting code from web pages etc far more difficult and, worse, makes automatically reindenting a block of code in an editor impossible. If I come across a badly formatted block of code in Ruby or Java or C in emacs it takes me one keypress to sort it out. In Python I have to carefully, manually look at each line.

It's also fun to spend an hour looking for a bug caused by somebody inserting a tab instead of a space somewhere. We had a production crash that took us a long time to fix because somebody hotfixed a file with the wrong editor and did this.

I also don't understand how forcing people to indent code in the same way magically makes people write good code. The kind of programmer that can't or won't indent his code properly is introducing bugs far more serious than bad layout into your project.

Python's a nice language in many ways but I consider the syntax to be a bug.

Post reply on HN