Live data from Hacker News

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

news.ycombinator.com

171–180 of 231 posts

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

#171
post #162

Earlier quoted context omitted.

Python has sets as a built-in datatype. If someone needs a different implementation, there's nothing stopping them from writing one.

A couple of points. 1. I love python. 2. The OP was being a troll. 3. People need to be more honest about themselves and their favorite pet languages. I can write a sorted set in assembler too, if I wanted. However, there's been several times that I've wanted a sorted set data type while coding in Python but found that none was easily available. I hate the, "you can write your own!" counterpoint, because it is essent…

I didn't mean to imply that lacking a sorted set datatype wasn't a pain in the ass; I was pointing out that the lack of multiple set implementations is a tradeoff that we make for all built-in datatypes that could support other operations but don't. (Personally, I would love to have the ability to pick a random element from a set. That would be great.)

By the way, in case anybody was wondering, here is a (relatively inefficient) way of making a sorted set in python:

http://code.activestate.com/recipes/576694/

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

#172
A lot of us don't like Python. It's a language with a mediocre design, a somewhat frustrating syntax, and a stubborn refusal to commit to such essentials as real closures and lambdas.

It's basically a language written by a group of people who don't trust you (as a Python user) to be knowledgable and educated. Decisions have been made based on the assumption that you are bad at your job.

Now, everyone seems to comfort themselves with the notion of making it “easy for maintenance”; repeating “I am smart, surely, but not everyone can be as smart as I am.” But this is ultimately a dodge that feeds into the problem endemic to our industry: a disdain for everyone else and everyone else's methods if they differ slightly from our indoctrinated best practices.

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

#173
post #167

Earlier quoted context omitted.

Agreed. And interesting you said C and Python. A few years ago I was thinking about what would be the minimum set of languages that would be good to know in order to be able to do almost anything you wanted, and do it well, and to always be employable. I ruled out 1 language alone because of the C phenomenon: there's a whole class of software where today C is the best choice, and a whole different set where C is a ba…

No, Google picked C++, not C. Very different philosophy!

Thanks, looks like you may be right. I just found a post by Steve Yegge in 2007 where he said it was C++, Java, Python and JavaScript. I'm pretty sure I found references elsewhere to C/Java/Python though. Close enough.

I had forgotten about JavaScript, I guess I considered that one a no-brainer on the browser side. However, the line blurs between C and C++, especially if you use the extra stuff only tactically as needed rather than a hard-core-always-OO-and-templates approach.

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

#174

Earlier quoted context omitted.

""" 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. """ This is such an absolutely fantastic way of succinctly describing why I dislike Java so much. Bureaucratic! Absolutely fantastic post, get this on a blog somewhere. I seriously wish I could upvote you more.

It's also a great way of specifying why I love it. Having been bitten on the ass one too many times by typing problems in a Python project, the feeling of confidence I get from doing the Java bureaucracy (to some extent mitigated now I do Scala instead) is something I have really come to love. It's like a security blanket for me.

I think zeph is saying it a little strongly, but doctests find a HUGE portion of typing errors with python. Additionally, many people who do have typing problems find many go away when they make their python code slightly more object oriented.

Here is a link to doctests. There are godly, and unlike any testing library, in that they aren't a library, they're a comment scanner: http://docs.python.org/library/doctest.html

Smallest amount of rigmarole required to make testing happen I've seen in any language.

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

#175
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…

""" 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. """ This is such an absolutely fantastic way of succinctly describing why I dislike Java so much. Bureaucratic! Absolutely fantastic post, get this on a blog somewhere. I seriously wish I could upvote you more.

I haven't use that blog in awhile, but here you go: http://rowdybytes.blogspot.com/2010/06/learning-to-love-pyth...

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

#176
post #119

Earlier quoted context omitted.

I'm willing to forgive the creators of Python if they didn't optimize their syntax for copying-and-pasting code. Hotfixing is a naturally perilous process regardless of language. I've spent hours tracking down untested hotfixes in Java. You're also probably less likely to come across a badly formatted block of python code because that would generally result in a bug. Much like misplaced brackets in Java/C/C++ would r…

I'm willing to forgive the creators of Python if they didn't optimize their syntax for copying-and-pasting code. Copying and pasting is also known as refactoring. A syntax that makes that much harder than it needs to be is mis-optimized, IMO.

But code is read far more than refactored, so I think it's an okay tradeoff. (Plus what editors are ya'll using where changing the indentation of something is difficult?)

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

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

I agree that short python samples are as clear as a high level language can possibly be. Implementing algorithms, for instance, becomes incredibly easy in Python. I face problems when Python programs get above a certain length. I've done some Django programming in the past. A view gets a request object (pardon me if I'm wrong or if this has changed recently) and is supposed to then render the response (or something s…

To complement what other people are recommending here, I'd say that in cases like this I only sometimes read the documentation. Other times I put a line in my code:

  import pdb; pdb.set_trace()
which makes it enter the debugger at that point, and I simply inspect the object that I'm really getting, looking at what it supports, the documentation on its methods, etc.

Doing it this way is not always feasible, since sometimes there's a prohibitive amount of setup code that needs running before you can get a real object. For short code paths though, like Django apps, it works really well.

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

#178

Earlier quoted context omitted.

It's also a great way of specifying why I love it. Having been bitten on the ass one too many times by typing problems in a Python project, the feeling of confidence I get from doing the Java bureaucracy (to some extent mitigated now I do Scala instead) is something I have really come to love. It's like a security blanket for me.

(Disclaimer: Not meant as flamebait) Not to be a prick, but if you're having "typing" problems with Python, you're using it wrong. Types are almost irrelevant in Python. What matters is whether, in a given situation, the method you're calling is supported and does what is intended. The actual type/class of the receiving object doesn't really matter, ditto for any arguments you pass to the method. While this may seem…

Honestly, I program in Python every day and my biggest complaint is that duck typing and dynamic types as a paradigm is not well suited for large projects (like the ones I work on). When the codebase is larger than you can keep in your head, the types become a huge issue. When a bug is at one level of an application you have to figure out what argument was passed in. In a language like Java or C#, it is trivial to follow the trail of objects. In Python, it is cumbersome to say the least. Likewise, if you do adopt duck typing you will eventually find that there is no way around dispatching via types at some point. Again, it is not that huge of a deal, but it ends up being boilerplate-ish code you don't want to write.

Tests are effectively the answer, but they are a pain to write and having to document your type information via tests seems a lot more cumbersome from just doing "int my_var".

The party line with Python and dynamic typing is true in many cases, especially when starting a new project. As time goes on though, things get confusing and tests are rarely good enough to offer the same contract static typing offers. To say "you're doing it wrong" is somewhat correct, but no one does it right all the time.

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

#179
post #43

Earlier quoted context omitted.

You don't really appreciate Python until you try and program in something like Java again. The following code is readable and I have required a variation of it in a program before: sorted([ord(c) for c in set('letters in this sentence') & set('and this one')], reverse=True) Doing it in Java would be a chore now.

I'm not sure any decent Java developers would encourage starting a new project in Java anymore. This is exactly the sort of thing that Scala is just as good at. Scala isn't as succinct, of course, but it gets much closer!

If you look at my Scala examples above, they are both more succinct than their Clojure and Python counterparts.

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

#180
post #147
post #107

Earlier quoted context omitted.

Given a = [1, 2, 3, 4, 5]: Ruby: a.map{|i| i+1}.reject{|i| i%3 == 0}.map{|i| i*i} Python: [i*i for i in filter(lambda i: i%3 != 0, [i+1 for i in a])] Please ignore the fact that the whole operation can be simplified mathematically - nontrivial map-grep-map operations do occur. I find the Ruby version clearer because it proceeds from left to right like a shell pipeline.

In Perl 6: @a.map({ $_ + 1 }).grep({ $_ % 3 != 0 }).map({ $_ * $_ }) Alternately, using the feed operator ==>: @a ==> map { $_ + 1 } ==> grep { $_ % 3 != 0 } ==> map { $_ * $_ } And, if your code being readable to people who've never used Perl 6 and know nothing about it isn't a concern, you can use the much more concise Whatever star notation for closures: @a ==> map * + 1 ==> grep * % 3 != 0 ==> map { $_ * $_ } Usi…

I think this is a great example why Perl 6 highly intrigues me but at the same time scares the crap out of me. Thanks for sharing.
Post reply on HN