1. 8

  2. 3

    This is one if the issues I run into often with Python. Not that this happens but that I’m terrified it will. I remember when I first used Java I was annoyed that if something wasn’t a bool I had to compare it to something, but then I learned better.

    1. 5

      The joy of do what I want programming. Don’t like what you get? have you considered wanting something else?

      1. 4

        Like the part where a time object representing midnight UTC is falsy? (Though they did fix this in 3.5.)

        1. 3

          I don’t actually understand how to use Python3. So many things (map, filter, ..) now return generators now rather than realized lists which means the following code will evaluate the true branch of the if under all cases. I have found this very confuse and unintuitive.

          x = filter(...)
          if x:
          1. 2

            Having non-boolean values being “truthy” and “falsy” is a big mistake IMO: high potential for mistakes when the data changes (or even the language/library) with very little benefit (what is hard about while !x.empty(): ...?)

        2. 1

          I’ve found that a good rule of thumb for dynamic languages is to treat them like “static” languages but break the rules carefully.

          “Why not use a static language?” Well, it can be really hard to break the rules in those systems. And sometimes I gotta break the rules. (That said, I tend to prefer static languages if in the long run.)