Live data from Hacker News

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

news.ycombinator.com

191–200 of 231 posts

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

#191

Earlier quoted context omitted.

(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 fo…

protip: the next time you need to quickly find the type of a variable, insert a trace like:

import pdb;pdb.set_trace()

then run the program, and you'll get an interactive prompt and you can just look at everything in that state.

dir( myBuggyVariable)

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

#192

Earlier quoted context omitted.

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…

> If Django were in C, I would know what a request object really was, grep for it, and look up the header file. If Django were in python, you wouldn't even have to grep >>> import django.http, inspect >>> print inspect.getsource(django.http.HttpRequest)

Or even easier: ipython >>> from django.http import * >>> HttpRequest?? # prints out source code for HttpRequest

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

#193
post #7

Do you hate scripting languages in general? Maybe you should compare python with other scripting languages.

I really dislike the term "scripting languages". While you could describe Python and Ruby this way, it does them a huge disservice, implying that they aren't capable of large scale application development. I think this term should really be reserved for Bash et al.

I read "scripting language" as a legitimate warning about tradeoffs that make it unsuitable for high-volume use, because the code is permitted to change so much runtime behavior that most known optimizations (and other kinds of static analysis!) are ruled out. For example, Twitter's Ruby to Scala migration made news, so there's value in being able to broadly say what's different between those kinds of languages.

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

#194
I still write most of my code in C. Could never really warm to C++ and Java was fun in the early days, but the sheer volume of API's, J2EE, et al eventually crushed my spirit.

It took me several goes to become friendly with Python. I find it excellent to try out algorithms. If I don't know how something is going to be best implemented, then writing a bunch of classes in Python and tweaking attributes and methods until the algorithm is as simple as can be helps me get there very fast.

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

#195
post #189
post #157

Earlier quoted context omitted.

Not sure why we are posting alternative language implementations, but here is the Scala version :). You could say that this was an exercise for me in learning 2.8, which I am unfamiliar with. A for comprehension isn't needed because Scala already treats Strings as a sequence of characters. (Set("letters in this sentence":_* ) & Set("and this one":_* )).toSeq.sorted.reverse Or you, can take advantage of Scala's rich c…

An easier Ruby solution would be: ("letters in this sentence" + "and this one").chars.sort.reverse

Except you aren't using sets, so you get duplicate characters.

I can just as easily write ("letters in this sentence" + "and this one").toSeq.sorted.reverse in scala. You could tag the end of your ruby statement with .uniq and you would be fine. Alternatively, you could wrap the above scala statement in TreeSet(). These solutions process things in a significantly different way than was done by the OP, though.

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

#196

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.

If you like static guarantees, you might want to look into the type systems of, say, Clean or Haskell.

Java is almost untyped by comparison. Languages like Ocaml and F# occupy a middle ground.

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

#197
post #101
post #67

Earlier quoted context omitted.

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.

Number of financial companies using F# is about the same as for OCaml (but numbers are not evolving in the same manner). F# uses .NET which is way more tested than OCaml runtime. F# uses .NET libraries which are way more tested than OCaml libraries. F# core language is still a bit less tested, but considerable work is being done. In contrast, there is only fulltime person working on OCaml. OCaml community is dying, w…

We also use Ocaml here (Citrix), and people agree that Ocaml seems to be going nowhere. Some projects have started switching to Haskell.

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

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

> I started off hating Python as well. I could not stand a language that didn't terminate statements without semicolons! :)

I have exactly the opposite heuristic for syntax. The only thing worse than semicolons and curly braces, are `begin' and `end'.

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

#199

I don't much like it either. Came from C++, learned Perl, got a job writing Fortran, learned Lisp. When hating on Perl came into vogue on the internet, I said to myself, okay, I will learn Python as a Perl replacement. It is a decent Perl replacement, what with all the libraries and the fact that it is shebang-able. Now that I've dispensed with background, what I don't like about Python: 1. Assignments don't return v…

Perhaps `zip' could help address some of your points?

> 2. List comprehensions kind of suck. [(a, b) for a in as for b in bs] is a cartesian product and not a zip? Really?

Strange. I would say it sucked if it was the other way round. You can use the `zip' function, if you want a zip.

  zip (as, bs)
> 3. Loops don't help this either: There's no equivalent of the Lisp (loop for x in xs for y in ys do (stuff x y)). I have to explicitly loop over the index. This pisses me off.

Try the function `enumerate' and `zip'. E.g.

  for x,y in zip(xs, ys): stuff (x,y)
If you need an explicit index for your stuff:

  for (i, (x,y)) in zip(xs, ys): stuff (x,y)
> 4. I feel that I am generally shoehorned into creating and assigning more objects than I would like.

I agree, only the other way around. Python is much too destructive and relies on in-place updating. E.g. recently we got `sorted' that doesn't sort in-place but return a sorted array --- but the `shuffle' function still works only in-place. Also dicts are destructive. There should be a persistent (i.e. non-ephemeral) data structure for key-value-mappings in the standard library.

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

#200
post #87

Earlier quoted context omitted.

curious what you prefer about Ruby. i'm very familiar with python, and have only looked at Ruby long enough to decide (mistakenly?) that it wouldn't do anything for me which python doesn't already.

Ruby is incredibly flexible, whereas Python is not. Often times my idea of the way things should be done is not Guido's idea, and so Python seems a bit lacking. I really enjoy the pretty simply object model, the message passing OO, and blocks. An interesting point that I read somewhere the other day, from someone who codes in a lot of both: Ruby (to him) is kind of ugly, and Python is very pretty. Yet, the exact part…

> Ruby is incredibly flexible, whereas Python is not. Often times my idea of the way things should be done is not Guido's idea, and so Python seems a bit lacking.

Apropos: Does Ruby optimize tail calls?

Post reply on HN